Wednesday, April 12, 2017

When JSLint tells you: "Too many var statements."

Try declaring the variables all together on one line and then making their assignments on independent lines.

var foo, bar;
foo = function(){
   return 13;
};
bar = function(){
   return 42;
};

 
 

Could be a refactoring from:

var foo = function(){
   return 13;
};
var bar = function(){
   return 42;
};

 
 

Hopefully that will get JSLint to shutup.

No comments:

Post a Comment