IE8’s Substr() Bug
I thought I would share this gotcha in the hope it saves the rest of the world some time. Here’s the deal……
In IE8 and below when using substr() to parse a string you cannot use -1 as the startIndex parameter: it will return NaN and error out. As an example, this will not work:-
var index = id.substr(-1, 1);
Instead you would need to do the following:-
var index = id.substr(id.length-1, 1);
Very small Yay!