Hi…
We all know, Arrays are nothing but variables which can hold all your variable values with a single name.
Let’s see some basic operations of Arrays in JavaScript.
To Create a New Array. Use the following code.
var myArray = new Array();
This code of line created a new Array object called myArray.
Adding Elements to myArray
myArray[0]= "you"; myArray[1] = "me"; myArray[2] = "we";
or
var myArray=new Array("you","me","we");
or
var myArray=["you","me","we"];
Accessing Array Elements
document.write(myArray[0]);
It will print ‘you’!
🙂