remove last data from array jquery – How to Remove Last Element from Array in JQuery?

remove last data from array jquery – The standard method to remove the last element from an array is with the pop() method.

remove last data from array jquery

This pop() method works by modifying the original array. Return value: Returns a new Array step by step explain jquery array remove last element.

Example 1: Remove Last Element from Jquery Array

remove_last_element_from_jquery_array.html

<!DOCTYPE html>
<html>
<head>
   <title>How to Remove Last Element in Jquery Array? - pakainfo.com</title>
   <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
</head>
<body>
  
<script type="text/javascript">
  
    var bloggerlist = [ "pakainfo.com", "infinityknow.com", "google.com", "w3school.com" ];
  
    bloggerlist.pop();
  
    console.log(bloggerlist);
  
</script>
  
</body>
</html>

Results:

["pakainfo.com", "infinityknow.com", "google.com"]

don’t miss : Jquery Remove Element From Array

Also Read This πŸ‘‰   submit form using jquery

Example 2: Remove First Element from Array

remove_first_element_from_array.html

<!DOCTYPE html>
<html>
<head>
   <title>How to Remove First Element from Jquery Array? - pakainfo.com</title>
   <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
</head>
<body>
  
<script type="text/javascript">
   
    var bloggerlist = [ "pakainfo.com", "infinityknow.com", "google.com", "w3school.com" ];
  
    bloggerlist.shift();
  
    console.log(bloggerlist);
  
</script>
  
</body>
</html>

Result

["infinityknow.com", "google.com", "w3school.com"]

Free Live Chat for Any Issue

I hope you get an idea about remove last data from array jquery.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Rate this post