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

后端 未结 7 1043
栀梦
栀梦 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 06:06

    I had this problem on my codebase, when we wanted to switch to the latest version of JSLINT. We had a lot of those and people were not happy about moving the declaration. We actually found the most elegant solution was to use underscore.js and instead of having the full verbose loop, to use the _.each() function, which removed the JSLint error and made our code more functional, cleaner, tighter and easier to read.

    0 讨论(0)
提交回复
热议问题