JavaScript eval() Function

The eval() function evaluates or executes an argument. If the argument is an expression, eval() evaluates the expression. If the argument is one or more JavaScript statements, eval() executes the statements.

Syntax

eval(string)

Example

<script language="JavaScript">

eval("x=10;y=20;document.write(x*y)");
document.write("&lt;br /&gt;" + eval("2+2"));
document.write("&lt;br /&gt;" + eval(x+17));

</script>

Output

200
4
27
DOWNLOAD SOLUTION HERE