A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/javascript/eval below:

eval ยท WebPlatform Docs

eval Summary

Evaluates JavaScript code and executes it.

Syntax
eval( codeString )
codeString
Required. A String value that contains valid JavaScript code.
Examples

The following code initializes the variable myDate to a test date.

var dateFn = "Date(1971,3,8)";
 var myDate;
 eval("myDate = new " + dateFn + ";");

 document.write(myDate);

 
Remarks

The eval function enables dynamic execution of JavaScript source code.

The codeString string is parsed by the JavaScript parser and executed.

The code passed to the eval function is executed in the same context as the call to the eval function.

Whenever possible, use the JSON.parse function to de-serialize JavaScript Object Notation (JSON) text. The JSON.parse function is more secure and executes faster than the eval function.

See also Other articles Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4