I finally got around to investigating an IE bug I’ve been meaning to look into. The root cause was a difference between JScript and ECMAScript as regards array.splice(). The signature for this handy method that removes and inserts array elements in place:
splice(start, deleteCount, value, ...)
According to the standard, only start (the index at which to start removing elements) is a required argument. So:
var a = ["e1", "e2", "e3"];
a.splice(1);
should result in a
being a single-element array containing “e1″. But of course, IE does not see it that way. According to MSDN, deleteCount is also required argument. Thus, the above would have to be:
var a = ["e1", "e2", "e3"];
a.splice(1, a.length-1);
It didn’t take too long to figure this out, but Google let me down and didn’t turn up anything about this. It’s been a long time since I had to turn to the MSDN reference docs. Maybe this tip will help someone…at the very least, it’ll help me remember!