+ 3
How to create an array in JS
I'm stuck somewhere. I want to store all items in my list in one variable (var) using JavaScript. I need help please.
4 Answers
+ 5
Hi Ryan Zico
Please note that how to create an Array is available in course of JavaScript, please view it!
Array in Js -> https://www.sololearn.com/learning/1239/
https://www.sololearn.com/learn/JavaScript/1239/?ref=app
+ 3
One very simple and commonly used way is with square brackets. This is called an the literal notation.
var myList = []
This will create an empty array. You can add items to it using various methods like push or using the index number.
If you want to create an array with items from the start, you can do this.
var myList = ["first", "second"]