Array: Arrays are used to store elements. Array is a collection of elements.
eg: let arr = [5, 44, 87, 9]
arr[0] = 5;
arr[1] = 44;
length is a method of array which returns total no of elements in the array.
//Arrays Methods:
i. push: push is used to insert a value into the array as last value
e.g: array.push(values)
ii. pop(): pop is used to remove only the last value of the array
eg: array.pop()
iii. unshift : unshift is used to insert value or values into the array as first value
e.g: array.unshift(values)
iv. shift(): shift is used to remove only starting vlaue of the array
eg: array.shift()
v. splice: splice(starting_index, deleteCount, insertValues)
It is used to delete any number of values or insert any number of values to the array
let arr = [5,4,6,7];
arr.splice(1,1)
arr.splice(1) -- will delete whole array from index 1
arr.splice(1, 2) -- will delete 2 values from index 1
arr.splice(1, 2, "shekhar") -- will delete 2 values from index 1 and add shkhar at index 1
vi.…