Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

eval

The eval() function of the Global object is used to interpret strings as executable code in the program.

Syntaxeval( string )

Parameters

string The string to be interpreted as code in the program.

Examples

Run eval() on a string representing the alert() method: eval( "alert( 'hi' );" ); Run eval() on multiple statements: eval("var a = 50, b = 30, c = 10; alert( a + b - c );"); Run eval() over multiple lines by escaping each new line with a backslash: eval("var a = 50; \ var b = 30; \ var c = 10; \ alert( a + b - c );");

JavaScript

Methods

addEventListeneralertaveragebackblurconcatcreatedecodeURIdecodeURIComponentencodeURIencodeURIComponentevaleveryfilterforwardgoisArrayisFiniteisNaNjoinparseFloatparseIntpoppushpushStatereducereplaceStatereverseshiftshuffleslicesomesortspliceunshiftwrite