JavaScript syntax arrays

JavaScript syntax arrays are similar to Lingo-style linear lists in that each element in an array is a single value. One of the main differences between JavaScript syntax arrays and Lingo-style linear lists is that the index into an array always starts with 0.

You create a JavaScript syntax array by using the Array object. You can use either square brackets ([ ]) or the Array constructor to create an array. The following two statements create an array with two values:

// JavaScript syntax 
var myArray = [10, 15]; // using square brackets 
var myArray = new Array(10, 15); // using the Array constructor

You can also create empty arrays. The following two statements create an empty array:

// JavaScript syntax 
var myArray = []; 
var myArray = new Array();
Note: The Director Scripting Reference does not include a complete reference for JavaScript syntax Array objects. For more complete information on using Array objects, see one of the many third-party resources on the subject.