JavaScript – Remove First Element of Array

To remove first element of an array in JavaScript, call shift() method on this array. shift() method modifies the original array, and returns the removed element.

The syntax to remove the first element of array arr is

arr.shift()

Example

In the following example, we have taken an array in arr. We remove the first element from this array using shift() method.

index.html

ADVERTISEMENT

Conclusion

In this JavaScript Tutorial, we learned how to remove the first element of an array using shift() method.