index array javascript code example

Example 1: MDN array length

const clothing = ['shoes', 'shirts', 'socks', 'sweaters'];

console.log(clothing.length);
// expected output: 4

Example 2: javascript array

const arr = [1, 2, 3];

Example 3: array javascript

var familly = []; //no familly :(
var familly = new Array() // uncommon
var familly = [Talel, Wafa, Eline, True, 4];
console.log(familly[0]) //Talel
familly[0] + "<3" + familly[1] //Talel <3 Wafa
familly[3] = "Amir"; //New coming member in the family

Example 4: get array by array of indices js

var resultArr = indexArr.map(i => fruitier[i])

Example 5: access index of array javascript

let first = fruits[0]
// Apple

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