Home > javascript > Array’s last comma affect it’s length in IE

Array’s last comma affect it’s length in IE

October 20th, 2010
  var arr = [1, 2, 3,];
  alert(arr.length);

In firefox, the result is 3, but in IE, it is 4. It always takes some bugs which are hard to found. Right now, I don’t know which is the correct way, but I always remove the last comma safely.

javascript

  1. No comments yet.
  1. No trackbacks yet.
FireStats icon Powered by FireStats