have the following javascript code
// note: declaring i in this loop
for( var i=0; i<args.length; i++ ) {
var elem = args[i];
...
if( elem.attr == 'class' ) {
// note declaring arr and i in this loop
for( var arr=elem.val.split(' '), i=0; i<arr.length; i++ ) {
element.classList.add(arr[classCt]);
}
continue;
}
}
the problem is that i in the second for loop is the same i as declared in the first for loop.
thought that the var construct allowed multiple variables to be declared separated by commas.
when changed i to classCt in second loop, the code worked as expected
itoclassCtwhere? Theiin second for loop is indeed the same as the first because you are not initializing it again withvar.