javascript execute string code
var theInstructions = "alert('Hello World'); var x = 100";
var F=new Function (theInstructions);
return(F());
javascript execute string code
var theInstructions = "alert('Hello World'); var x = 100";
var F=new Function (theInstructions);
return(F());
what is eval in js
The eval() function evaluates JavaScript code represented as a string.
console.log(eval('2 + 2'));
// expected output: 4
console.log(eval(new String('2 + 2')));
// expected output: 2 + 2
console.log(eval('2 + 2') === eval('4'));
// expected output: true
console.log(eval('2 + 2') === eval(new String('2 + 2')));
// expected output: false
eval javascript
eval(string)
eval in javascript
eval() -> is able to evalute the things inside it , like eval(a+b+c) , wher a=3,b=4,c=4 , so eval(a+b+c) = 11
eval function
x = 1
print(eval('x + 1'))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us