gpt4 book ai didi

javascript - JSLint "document.write can be a form of eval"- 这是怎么回事?

转载 作者:可可西里 更新时间:2023-11-01 02:21:52 34 4
gpt4 key购买 nike

我在 JSLint 中看到过这条消息...

document.write can be a form of eval.

并想知道到底是怎么回事?

JSLint instructions页面状态:

The eval function...provide access to the JavaScript compiler. This is sometimes necessary, but in most cases it indicates the presence of extremely bad coding....

那么,document.write 如何“提供对 JavaScript 编译器的访问”呢?

谢谢

最佳答案

你的浏览器用这个做什么?

document.write('<script type="text/javascript">window.alert("evaled " + (1 + 2))</script>');

关于javascript - JSLint "document.write can be a form of eval"- 这是怎么回事?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5488843/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com