1var theInstructions = "alert('Hello World'); var x = 100";
2
3var F=new Function (theInstructions);
4
5return(F());
1The eval() function evaluates JavaScript code represented as a string.
2
3console.log(eval('2 + 2'));
4// expected output: 4
5
6console.log(eval(new String('2 + 2')));
7// expected output: 2 + 2
8
9console.log(eval('2 + 2') === eval('4'));
10// expected output: true
11
12console.log(eval('2 + 2') === eval(new String('2 + 2')));
13// expected output: false
14
15
1eval() -> 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