2011 February 20, last update 2012 November 6
This one caught me out with its cross-browser crazy-bandit style, see JavaScript split Bugs: Fixed! (2007 stevenlevithan.com)
When a limit is used the last element of the returned array does not contain the rest of the string. Seems strange to me but there is a work around, which was provided by Nick Craver on in reply to the question Split string once in javascript? (stackoverflow.com)
var split = string.split('|');
split = [split.shift(), split.join('|')];
For limits greater than 1 then array.splice could be used.
var class; causes IE to raise an error.
Another one that caught me out. RegExp.test returned true the first time, but didn't the second because it was no longer searching from the beginning of the string.
"... As with exec (or in combination with it), test called multiple times on the same global regular expression instance will advance past the previous match."
Mozilla JavaScript Docs 2011 March 20
Solution was to use RegExp.lastIndex = 0 after each use of RegExp.test.
RegExp.test (mozilla.org), RegExp.lastIndex (mozilla.org)
When doing a RegExp match a g flag causes the capture parenthesis to no longer capture. Just do the match without the g flag.
console.logAvoid raising errors without Firebug by using the following before using console.log:
window['console'] = window['console'] || {log:function(){}};