Because of javascript variable hoisting, jshint complains about :
function test() {
...
if( cond1 ) {
var a = ...
//do something with a
}
...
if( cond2 ) {
var a = ...
//do something with a
}
...
}
because it's equivalent to :
function test() {
var a;
var a;
...
if( cond1 ) {
a = ...
//do something with a
}
...
if( cond2 ) {
a = ...
//do something with a
}
...
}
Does the first approach can lead to bugs in some code ?