Home >Web Front-end >JS Tutorial >javascript eval() usage_javascript skills
Simply put, you can convert a string into an expression and return the execution result
eval method
please refer to
String object
applies to: Global object
requires
version 1
Check JScript code and execute.
eval(codeString)
Required codestring parameter is a string value containing valid JScript code. This string will be parsed and executed by the JScript parser.
Description
The eval function allows dynamic execution of JScript source code. For example, the following code creates a new variable mydate that contains a Date object:
eval("var mydate = new Date();");
The context passed to the eval method when the code is executed and the eval method is called The same.