-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[js] 第38天 说说你对eval的理解 #142
Comments
|
|
|
执行 js代码,有性能问题,又可以执行一些恶意代码。但是webpack中就用到了eval,所有一个东西用途还是需要看场景。 |
终极hack方法,从来不用 |
webpack中处理soucemap就用到了eval |
但是在特殊的场景下,使用起来会非常方便。我自己在工具库中获取深度对象的值时使用过 |
var json = '{"a": "Hello", "b": "World"}'; //标准json字串
var json2 = '{a: "Hello", b: "World"}'; //非标准
|
eval()接收一字符串,他会执行其中的JS代码 |
webpack使用的就是eval执行的压缩之后的代码 |
|
eval-souce-map和这是同一个东西吗 |
eval是可以执行js代码的,但是也可以执行恶意代码,对性能也有影响,要视情况而用,一般正常情况不建议使用。 |
第38天 说说你对eval的理解
The text was updated successfully, but these errors were encountered: