1var arr = [1, 2, 3, 4];
2var theRemovedElement = arr.shift(); // theRemovedElement == 1
3console.log(arr); // [2, 3, 4]
1// example (remove the last element in the array)
2let yourArray = ["aaa", "bbb", "ccc", "ddd"];
3yourArray.shift(); // yourArray = ["bbb", "ccc", "ddd"]
4
5// syntax:
6// <array-name>.shift();
1var array = [1, 2, 3]; // array of size 3
2array.shift(); // removes first element