JSLint error: Move all 'var' declarations to the top of the function

后端 未结 7 1090
栀梦
栀梦 2020-11-30 05:16

JSLint site updated, and I cannot check JS scripts anymore. For me, this warning is not critical, and I don\'t want to go through thousands of lines to fix this, I want to f

7条回答
  •  难免孤独
    2020-11-30 05:57

    Google Closure compiler will actually fail to correctly detect the type of the loop variable of a for...in loop unless it's declared like for (var i in ...) and no annotation seems to fix this, so the declaration cannot be moved to the top.

提交回复
热议问题