Pure JavaScript1E.g. SUITCASE INVENTORY
//Populate an array with suitcase contents
To create multidimensional arrays in JavaScript, the
element of an array must be another array. The inner aray can be
accessed by putting two [ ] operators back to back. The following
example shows that to access the brake parts list double [ ] operators
are used and the list is displayed in a table.
E.g. Brake Parts Inventory List
//Display brake part inventory in a table
Because arrays are essentially JavaScript objects,
it is possible to access the elements of the arrays as properties if a
string index is used. Dot notation is used, rather than the [ ]
operators. Both tht [ ] operators and the dot notation are interchangeable
when accessing an array, even in the same coding see the following example:
E.g Suitcase Contents
//Populate an array with suitcase contents
JavaScript 1.0 version originally used the Object()
constructor to create arrays and because the properties of an Object()
could be accessed using the [ ] operator, it was possible to give the illusion
of an array
//Display suitcase quantities
//Create a clothes quantity array
//Set clothes quantities
//Display the clothes quantities
The following contents list is derived from variables
assigned in the above JavaScript array
Multidimensional Arrays
//Display each part
//Display all information for each part
//Create a brake parts inventory list using a multidimensional array
//Display the inventory of brake parts
Arrays as Objects
JavaScript 1.0 Arrays