Check out example codes for "list javascript". It will help you in understanding the concepts better.

Code Example 1

var cars = ["Saab", "Volvo", "BMW"];

Code Example 2

//create an array like so:
var colors = ["red","blue","green"];

//you can loop through an array like this:
for (var i = 0; i < colors.length; i++) {

Code Example 3

//create array
var things = ["banana", "car", "computer"];
//access array(starts at 0)
//iterate through an array
for (var i = 0; i < things.length; i++) {

Code Example 4

<!doctype html>
  <title>Create a list in HTML and Javascript</title>
  <!-- Line 10 is where the list will pop-up after you press the button. 
	(line 11)-->
  <p id="grocery">See List Here. (Press the Button)</p>
  <button onClick=i()>Press to see Grocerries.</button>
function i() {
 //This is the list. (Line 13)
  var grocery = ["Apples","Bannanas","Strawberries"];
 document.getElementById(grocery).innerHTML = grocery;


Code Example 5

//Creating a list
var fruits = ["Apple", "Banana", "Cherry"];

//Creating an empty list
var books = [];

//Getting element of list
//Lists are ordered using indexes
//The first element in an list has an index of 0, 
//the second an index of 1,
//the third an index of 2,
//and so on.
console.log(fruits[0]) //This prints the first element 
//in the list fruits, which in this case is "Apple"

//Adding to lists
fruits.push("Orange") //This will add orange to the end of the list "fruits"
fruits[1]="Blueberry" //The second element will be changed to Blueberry

//Removing from lists
fruits.splice(0, 1) //This will remove the first element,
//in this case Apple, from the list
fruits.splice(0, 2) //Will remove first and second element
//Splice goes from index of first argument to index of second argument (excluding second argument)

Code Example 6

var fruits = ['Apple', 'Banana'];

// 2

Learn ReactJs, React Native from