I saw this example on mozilla documentation but i don't understand why.
if 0 is a property of trees, i was expecting that trees.0
would return redwood
but is a wrong statement. Is a[0]
a way to access the 0 property of the array ? In this case a["length"]
should also work (logicaly). Can anyone make it clear?
link: developer.mozilla.org
var trees = new Array("redwood", "bay", "cedar", "oak", "maple");
0 in trees; // returns true
3 in trees; // returns true
6 in trees; // returns false