arraywill give you the element at index 1 which is "css".
array[array.length - 1]will give you the last element if you don't know the length of the array.
array.indexOf('css')will return the index of element 'css' which is 1.
array.push('react')will add 'react' at the end of the array. You can add as many items as you want, just separate them with a comma.
array.unshift('react')will add 'react' at the start of the array (i.e. at index = 0).You can add as many items as you want, just separate them with a comma.
array.splice(2, 0, 'react')will delete 0 items starting from index 2 and then add 'react' at index 2.
array.pop()removes the last element from array.
array.shift()removes the first element from array.
array.splice(1, 2)will remove 2 elements starting from index 1.
array.slice(0, 1)will return a copy of portion of array (i.e. ['html', 'css'] in this case).
Looping through arrays
array.forEach(item => console.log(item))will loop through every element of the array.
array.map()is similar to
array.forEach()only difference being, map creates a new array and then perform opertations on it whereas forEach performs only the original array.
array.map()returns the new array with some operation applied on each element while
array.filter(item => item.length > 3)will return another array with elements whose length is greater than 3.
filter()method creates a new array with all elements that pass the test implemented by the provided function.