I've never noticed this before but
I get an alert, "one 0", whereasCode:var ray = new Array('one', 'two', 'three'); for (i in ray) { if (i) alert (ray[i]+" "+i); }
I don't, which is what I would expect. Why is zero counted as true in the first case?Code:var x = 0; if (x) alert("hello")


Reply With Quote
Bookmarks