JS
jQuery

How To Remove First Element From Array In JQuery?

Today our leading topic is jquery array remove first element. step by step explain how to remove first element from array in jquery. you can understand a concept of remove first element from array jquery. We will use jquery array remove first element.

  • 4.5/5.0
  • Last updated 08 September, 2022
  • By Admin

You can see both example of how to remove first key in jquery array.

let's see example.

You can see both example with output so, you can understand, how it works.

Example 1: Remove First Element from Jquery Array
<!DOCTYPE html>
<html>
<head>
   <title>How to Remove First Element in Jquery Array? - codewale.com</title>
   <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
</head>
<body>
<script type="text/javascript">
    var sites = [ "codewale.com", "flipkart.com", "amazon.com" ];
    sites.shift();
    console.log(sites);
</script>
</body>
</html>
Output
["flipkart.com", "amazon.com"]

Now we are ready to run our application, so let's run using bellow command:

npm start

Open bellow url:

http://localhost:3000

I hope it can help you...