Java web server - JavaScript Programmer’s Reference Array index delimiter ([ ])

JavaScript Programmer’s Reference Array index delimiter ([ ]) (Delimiter) Access elements of an array with this delimiter. the array length Array elements are indexed by selecting them numerically within the set of elements contained in the array. The length property of an array indicates how many indexable locations there are. Array elements begin with the zeroth item. Storing values into indexes that are higher than the current value of the length property will automatically extend the array and reset the length property. An array with only one entry in the 100th element (index value 99) is very sparsely populated but still should report a length value of 100. In Netscape, referencing the array with no element delimiters will yield a comma-separated list of the contents of the array. So this: Availability: ECMAScript edition 2 JavaScript 1.1 JScript 3.0 Internet Explorer 4.0 Netscape 3.0 Netscape Enterprise Server 2.0 Opera 3.0 Property/method value type: Depends on array content JavaScript syntax: -myArray[anIndex] Argument list: anIndex A legal index value into the array, not greater than myArray = new Array(6);myArray[0] = 0;myArray[1] = “XXX”;myArray[2] = 0;myArray[3] = “XXX”;myArray[4] = 0;myArray[5] = “XXX”;document.write(myArray); Yields this when executed: 0,XXX,0,XXX,0,XXX Accessing properties of an object by name simply requires the name to be added to the object reference with a dot separator between them. Numeric values cannot be used in this way. You must use a string to name the array element when it is assigned. The associativity is left to right. Refer to the operator precedence topic for details of execution order. Although JavaScript does not properly support multi-dimensional arrays, you can simulate them by storing references to one array in the elements of another. You need to create a separate array for each row and then one master array to arrange them into a column. True multi-dimensional arrays would use a notation like this: multiArray[1,2]

Leave a Reply