1. Definition and usage
The shift () method is used to delete the first element of the array from it and return the value of the first element.
grammar:
array.shift()
Note: This method changes the length of the array!
Examples:
var arr = [1,2,3,4,5]; console.log(arr.shift()); console.log(arr);
Output: