The use of eval method in js

grammar:

eval(string), where string is required, that is, the string to be calculated, which contains the JavaScript expression to be calculated or the statement to be executed.

return value:

The value (if any) obtained by evaluating string.

illustrate:

The method accepts only raw strings as parameters, and if the string parameter is not a raw string, the method returns unchanged. So please do not pass String objects as parameters to the eval() function .

The ECMAScript implementation allows an EvalError to be thrown if an attempt is made to override the eval attribute or assign the eval() method to another attribute and call it through that attribute.

 

Guess you like

Origin blog.csdn.net/weixin_42689147/article/details/88774377