What is the use of eval function in js

青灯夜游
Release: 2019-06-01 10:40:14
Original
14124 people have browsed it

What is the use of eval function in js

The eval() function is used to calculate a JavaScript string and execute it as script code. If the argument is an expression, the eval() function will execute the expression. If the argument is a Javascript statement, eval() will execute the Javascript statement.

Syntax

eval(string)
Copy after login

Parameters:

● string: required. A string to evaluate that contains a JavaScript expression to evaluate or a statement to execute.

Description:All major browsers support the eval() function

Example:

Copy after login

Output:

200 4 27
Copy after login

What is the use of eval function in js

The above is the detailed content of What is the use of eval function in js. For more information, please follow other related articles on the PHP Chinese website!

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!