To create a new array, you create a new instance of the Array object:
var arrayName = new Array(number of elements);
The number of elements is just the initial number of elements in the array; you can add more on the fly as you work with the array, but it is a good idea to initialize the array with the likely number of elements you will use.
- Open a new HTML document in your preferred HTML or text editor.
- Create the head of the document with opening and closing head
- Insert a script block in the head of the document:
- Create a variable named myArray and initialize it as a new array with five elements:
var myArray = new Array(5);
- Save the file and close it.
SharePoint Online FREE Training
JOIN a FREE SharePoint Video Course (3 Part Video Series)