Knowledge Walls
John Peter
Pune, Maharashtra, India
How to push and pop method in javascript array object with Example
6271 Views
Array class in Javascript supports push and pop method to insert and pop up data from array objects. Array push and pop is same as stack data structure "Last come First Out".
Example
var companyList = new Array();

companyList.push("Microsoft");
companyList.push("Sun Micro System");
companyList.push("Hyundai");
companyList.push("TaTa");

document.write(companyList);
document.write("<br />");

companyList.pop();

document.write(companyList);
document.write("<br />");

companyList.pop();
companyList.pop();

document.write(companyList);
document.write("<br />");
Demo & Output 
Best Lessons of "Good Javascript Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details