What is the reason behind JSLint saying there are “too many var statements”

后端 未结 7 1141
时光说笑
时光说笑 2020-12-13 12:06

JSLint (with the onevar flag turned on) is flagging some javascript code that I have with the following:

Problem at line 5 character 15: Too many var statements.         


        
7条回答
  •  臣服心动
    2020-12-13 12:38

    Just a guess here, but it may be time for functional decomposition. Functions should do one thing and do it well.

    Too many vars is suggestive of a function that's trying to do too much. Or a case where you should be using an array.

提交回复
热议问题