5 ms·
If you're new to Javascript/Actionscript/ECMAScript you might think there is a difference between objects (maps) and arrays, but there isn't. An array is simply
by pan69 16y ago
If you're new to Javascript/Actionscript/ECMAScript you might think there is a difference between objects (maps) and arrays, but there isn't. An array is simply a map (object) with the properties 0, 1, 2 etc. set to specific values.
This will list the properties of the map (0, 1, 2):
var a = ['a', 'b', 'c'];
for( i in a )
{
console.log( i );
}
This will list the values of those properties:
var a = ['a', 'b', 'c'];
for( i in a )
{
console.log( a[i] );
}
- TrevorBurnham 16y agoAnd god help you if you've extended the Array or Object prototypes.
- pan69 16y agoAmen