/ Published in: JavaScript
[1] To create an array, use either the new Array() or [] syntax.
[2] In JavaScript, arrays and objects are almost equivalent, and accessing a named cell of an array is the same as accessing a property of an object. If a cell of an array is called 'mycell', you could use either of these to access its contents
[3] faked multidimensional arrays
Expand |
Embed | Plain Text
// --------------------------------------------------------------- // [1] var nameOfArray = new Array(); var nameOfArray = new Array('content_of_first_cell','and_the_second' 8,'blah','etc'); var nameOfArray = ['content_of_first_cell','and_the_second',8,'blah','etc']; // --------------------------------------------------------------- // [2] nameOfArray['mycell'] nameOfArray.mycell // --------------------------------------------------------------- // [3] var nameOfArray = new Array(new Array(1,2,3,4),'hello',['a','b','c']); nameOfArray[name_or_number_of_entry][name_or_number_of_inner_entry]
You need to login to post a comment.
