array.index javascript code example

Example 1: array javascript

special_dates = [];
special_dates.push(new Date('2021/02/12').getTime());
special_dates.push(new Date('2021/02/13').getTime());
special_dates.push(new Date('2021/02/14').getTime());

			
for (var i = 0; i < special_dates.length; i++) {
 console.log(special_dates[i]) ;
}

Example 2: array

// An array in javascript is basicly a data structure set out like this:
const MyArray = {"Object1", "Object2", "Object3"};

Example 3: access index of array javascript

let first = fruits[0]
// Apple

let last = fruits[fruits.length - 1]
// Banana