We have already taken a look at different variable types, but there is a special type that we should explore a bit more—the array. Any variable type can be made into an array. An array is a container that holds multiple values of the same variable type. For example, an array of the String variable type may contain values such as "Mum", "Dad", "Sister", and "Brother", whereas an array of VC:VirtualMachine may contain multiple VMs.
By defining its content:
var family = new Array("Mum", "Dad", "Sister", "Brother");
Using a more compact style:
var family=["Mum", "Dad", "Sister", "Brother"];
Alternatively, if you want to initialize an empty array, just use the following:
var family = new Array();
If you want to add an element to an array, you just push it in: