Sunday, May 15, 2011

Trailing Comma and Internet Explorer 8

I thought that JavaScript was supporting trailing comma as more language do now.
Well no do not use it. Internet Explorer does not break but will add an undefined extra element. Chrome, FireFox and Safari will not.

var l = [1,2,3,];
print(l.length);
for(var i=0; i<l.length; i++){
    print(""+i+"="+l[i]);
}

No comments:

Post a Comment