Home > Web Front-end > JS Tutorial > body text

javascript eval() usage_javascript skills

WBOY
Release: 2016-05-16 18:54:53
Original
1124 people have browsed it

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.


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]

Look at this case:
Just remove the comments and run it and you will understand.
[Ctrl A select all Note:
If you need to introduce external Js, you need to refresh to execute ]
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template