Subscribe to Subscribers

Resources » TypeScript » Scripting Languages » Javascript

PUSH POP in javascript


Posted Date:     Category: Javascript    
Author: Member Level: Gold    Points: 5



push() and pop() methods used to add and remove the elements of the Array.
These mehtods operate on the end of the Array.

USING PUSH

var friends = ["Rekha", "chandra"]
friends.push("Sastry");
alert(friends);



OUTPUT:
========
Rekha,chandra,Sastry
It adds the value at the end of the array.

USING POP.
The pop() method removes the last element and returns the element that is removed.


var friends =["Rekha",chandra","Sastry"];
var res = friends.pop();
alert(res);


OUTPUT:
======
Sastry

NOTE:Now the length of the array is decremented by 1.





Did you like this resource? Share it with your friends and show your love!


Responses to "PUSH POP in javascript"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: join() method in javascript
    Previous Resource: Using shift and unshift to Add and Remove Elements using JavaScript
    Return to Resources
    Post New Resource
    Category: Javascript


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    PUSH AND POP in javascript  .  

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2013 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.