Javascript Arrays
Arrays
Below is an example about nulls and arrays
var arrayTest = new Array();
arrayTest[0] = 'hello';
arrayTest[3] = 'bye';
var output = "arrayTest length: " + arrayTest.length;
output += "\n";
output += "0: " + arrayTest[0];
output += "\n";
output += "1: " + arrayTest[1];
output += "\n";
if (arrayTest[1] == null) {
output += "arrayTest[1] is null\n";
}
output += "2: " + arrayTest[2];
output += "\n";
output += "3: " + arrayTest[3];
output += "\n";
output now holds:
arrayTest length: 4 0: hello 1: undefined arrayTest[1] is null 2: undefined 3: bye
Published: Sunday, 31 December 2006

