document.write can be a form of eval
那个警告是什么意思啊???
2014-10-23
JSLint flags any use of the eval statement with the message eval is evil. This is because eval is a hook right into the JavaScript compiler. It accepts a string as a parameter and then compiles it and runs it.
Further resources on the evils of eval are available through the above link. Here we are more interested in how document.write can equate to eval
So how can document.write possibly equate to being the same? Well, we can demonstrate this with a simple example. You’ll need to set up an HTML page and a JS File with the following code:
举报