MENU
Eval()
Strings of JavaScript code can be executed by using the eval() function. For example, you can use eval() to 'convert' a normal string to a template string.
Notice the difference between a string literal and a String object here.
RESETRUNFULL
RESETRUNFULL
<!DOCTYPE html><html><body><script>
<!DOCTYPE html><html><body><script>
console.log(eval('3*4')); // 12
console.log(eval(new String('3*4'))); // String object
eval('x=10;');
console.log(x); // 10;</script></body></html>
</script></body><html>