How to Remove First Element from Array in JQuery?
Published On: 10/08/2022 | Category:
JQuery

Hello Friends,
This tutorial is focused on jquery array remove first element. you will learn jquery array remove first element example. We will look at example of how to remove first element from array in jquery. I’m going to show you about remove first element from array jquery.
Here, you can see both example of how to remove first key in jquery array.
I will give you a full example of how to remove first key in jquery.
Example 1: Remove First Element from Array<!DOCTYPE html> <html> <head> <title>How to Remove First Element in Jquery Array? - Tuts-Station.com</title> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> </head> <body> <script type="text/javascript"> var sites = [ "Bhavesh", "Vishal", "Mehul", "Keval" ]; sites.shift(); console.log(sites); </script> </body> </html>Output
[ "Vishal", "Mehul", "Keval" ]Example 2 : Remove Last Element from Jquery Array
<!DOCTYPE html> <html> <head> <title>How to Remove Last Element in Jquery Array? - Tuts-Station.com</title> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> </head> <body> <script type="text/javascript"> var sites = [ "Bhavesh", "Vishal", "Keval", "Mehul" ]; sites.pop(); console.log(sites); </script> </body> </html>Output
[ "Bhavesh", "Vishal", "Keval" ];
It will help you...