What Is A JavaScript Array?
Solution 1:
A JavaScript array is a hash object with array functions attached using Array.prototype
. Put simply, this is an "Array" in JavaScript:
var x = {
length : 3,
'0' : 'first',
'1' : 'second',
'2' : 'third'
};
x.__proto__ = Array.prototype;
All of the array functions only act on indexes, as you would expect, however you can also do anything to an array object that you would do to a general JS object:
ary.foo = 'bar';
Solution 2:
To a basic yes or no question: Yes all of what you said is true.
Here is a whole array tutorial
Solution 3:
a good read ( that got me going at start ) Mastering Javascript Arrays
Solution 4:
Any JavaScript array is an object that can use different objects* as keys, making it a hash.
*all objects different from strings will be converted to string [object Object]
, so they will act as the same key! (thanks to cwolves :)
Solution 5:
Javascript objects are associative arrays. Javascript has an Object called Array that has special methods for dealing with their data.
Post a Comment for "What Is A JavaScript Array?"