JavaScript_Succinctly
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
An Array() is just a special type of Object(). That is, Array() instances are basically<br />
Object() instances with a couple of extra functions (e.g., .length and a built-in<br />
numeric index).<br />
Values contained in an array are commonly referred to as elements.<br />
Array() parameters<br />
You can pass the values of an array instance to the constructor as comma-separated<br />
parameters (e.g., new Array('foo', 'bar');). The Array() constructor can take up<br />
to 4,294,967,295 parameters.<br />
However, if only one parameter is sent to the Array() constructor and that value is an<br />
integer (e.g., '1', '123', or '1.0'), it will be used to set up the length of the array, and will<br />
not be used as a value contained within the array.<br />
Sample: sample134.html<br />
<br />
var foo = new Array(1, 2, 3);<br />
var bar = new Array(100);<br />
console.log(foo[0], foo[2]); // Logs '1 3'.<br />
console.log(bar[0], bar.length); // Logs 'undefined 100'.<br />
<br />
Array() properties and methods<br />
The Array() object has the following properties (not including inherited properties and<br />
methods):<br />
Properties (e.g., Array.prototype):<br />
prototype<br />
Array object instance properties and methods<br />
Array object instances have the following properties and methods (not including<br />
inherited properties and methods):<br />
Instance Properties (e.g., var myArray = ['foo', 'bar']; myArray.length;):<br />
constructor<br />
132