The rationale has already been described.
The recommendation is to use this form:
var myVar1 = document.getElementById("myDiv1"), myVar2 = document.getElementById("myDiv2");
or that:
var myVar1, myVar2; myVar1 = document.getElementById("myDiv1"); myVar2 = document.getElementById("myDiv2");
But this does not look very good, especially if you want to document vars.
So, you can temporarily disable this warning:
var myVar1 = document.getElementById("myDiv1"); var myVar2 = document.getElementById("myDiv2");
Warning: make sure this is done at the top of the function.
I think this is done because jslint cannot reliably determine if vars were declared at the top of the function or not.
Vanuan Oct 13 '12 at 23:08 2012-10-13 23:08
source share