eval()

The eval() method is used to return the value of the instructions within the parentheses. It will accept a string of statements and execute the string as source code, then return the result.

syntax:

eval(command)

eval(string)

EXAMPLE

function evalIt() {

eval(document.form1.input1.value);

}

This example is used to evaluate the JavaScript string which is entered in the textbox form control (form1, input1). The string od commands are executed, and the result is returned.