In this example, we will create an array and use the
shift() method to remove an element from the front.
myArray = [200,56,100,44,76]; myArray.shift(); console.log(myArray);
In the above example, the
shift() method will remove the first element from the front which is 200.
Though you can store the deleted value in a variable. We just want to display the status of the array after deletion.
[56, 100, 44, 76]
Note that the
shift() method is like
pop() and deletes only one element.