IE and its broken substr()

substr() is a very simple function for working with strings. It's been around forever, and is well documented. I recently had need to find the last character of a string in javascript. Everything was working fine in Firefox and Chrome, but IE was breaking.

'abcdef'.substr(-1,1)

That is, start at 1 character from the end (-1) and return 1 character. In all other browsers this returns 'f' but in IE it returns 'a'.



Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.234.143.26
To prevent spam please submit by clicking the kitten: