gpt4 book ai didi

javascript - 为什么jslint会高亮++?

转载 作者:行者123 更新时间:2023-11-28 02:39:43 25 4
gpt4 key购买 nike

我有以下代码:

for (i = 0; i < json.AnsData.length; i++) {

jsLint 告诉我:

Warning 96  JS Lint: Unexpected '++'.

有谁知道这是为什么吗?

最佳答案

来自http://www.jslint.com/lint.html :

The ++ (increment) and -- (decrement) operators have been known to contribute to bad code by encouraging excessive trickiness. They are second only to faulty architecture in enabling to viruses and other security menaces. Also, preincrement/postincrement confusion can produce off-by-one errors that are extremely difficult to diagnose. There is a plusplus option that allows the use of these operators.

JSLint 非常严格,反射(reflect)了其作者 Douglas Crockford 的观点。克罗克福德很棒,但他也非常固执己见,有些人发现他的观点离他们的口味太远了。如果您发现无法避免避免 ++,请尝试使用 JSHint 而不是 JSLint(或在 JSLint 中设置选项以容忍 ++)。

关于javascript - 为什么jslint会高亮++?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12870592/

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