Table of contents

Remove Last Element from Array in Javascript

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

 

Here is the example solution below:

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

websites.pop();

console.log(websites);

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

 

I hope it helps. Thank you for reading :)