Categories
JavaScript Answers

How to remove first element from an array in JavaScript?

Spread the love

To remove element from an array in JavaScript, we use the shift method.

For instance, we write

const array = [1, 2, 3, 4, 5];
array.shift();

to call array.shift to remove the first element of array in place.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *