I thougth “bad escapement” stands for wrong use escaping with slash.
Why does JSLint bring up the message in this function on the 3d line (for…)?
function splitTags(commaSeparated) {
var tagArray = commaSeparated.split(',');
for (var i=(tagArray.length) - 1; i>=0; i = i - 1 ){
tagArray[i] = f.trim(tagArray[i]);
}
return tagArray;
}
f.splitTags=splitTags;
Edit: I changed the “i–” to “i=i-1” and posted the changed version above.
Lint complains at character 30, which is the first minus sign.
Edit2: After this change it does not complain anymore. New version that works:
function splitTags(commaSeparated) {
var tagArray = commaSeparated.split(',');
var startWith = tagArray.length - 1;
for (var i=startWith; i>=0; i = i - 1 ){
tagArray[i] = f.trim(tagArray[i]);
}
return tagArray;
}
f.splitTags=splitTags;
Strange. I am actually using JSLint multi: http://ajaxian.com/archives/jslint-multi
So this is not solved but I have a workaround. But would be nice to get the real answer, I still have many of such code parts.
I guess from the workaround that I posted in the Edit of the question that JSLint multi does not like the
lengthkeyword in the for line at all.Do not use length there but calculate it in the line before and use a variable.
A rule to make JSLint multi not complain.