How to Remove First Element from Array in Javascript?

In this post, I'm sharing a short post on how to remove the first element value from an array in Javascript. If you need to remove the first value of the array before processing the data then array.shift() done this.

Created on: Sep 08, 2021
746
How to Remove First Element from Array in Javascript?

In this post, I'm sharing a short post on how to remove the first element value from an array in Javascript. If you need to remove the first value of the array before processing the data then array.shift() done this.

Here is the example solution below:

<script>
var websites = ['google.com', 'facebook.com', 'youtube.com'];

websites.shift();

console.log(websites);

// result: ["facebook.com", "youtube.com"]
</script>

I hope it helps. Thank you for reading :)

Leave a Comment