How to use array in javascript
How to use array in javascript
1 Answer
The array is usually used to store a set of variable data in a single variable
To create array in JavaScript you can use New Keywords
var MyArr= new Array("Ahmad", "Ali", "Wael");
The second way to create array in JavaScript
var MyArr=["Ahmad", "Ali", "Wael"];
To access array value
var MyArr=["Ahmad", "Ali", "Wael"];
console.log(MyArr[0]); // "Ahmad"
console.log(MyArr[1]); // "Ali"
console.log(MyArr[2]); // "Wael"
answer Link