offline version v3


14 of 264 menu

eval function

The eval function executes a code line as JavaScript code.

Syntax

eval(a line with code);

Example

In this example, alert with some message will be called:

eval("alert('Hello word')");

Example

In this example, the result of the sum of two variables will be displayed:

let code = "let a=10; let b=20; document.write(a+b)"; eval(code);
enru