Expert Developer JavaScript Question: Download Questions PDF
Explain what is pop()method in JavaScript?
![Expert JavaScript Developer Interview Answer Expert JavaScript Developer Interview Question](https://globalguideline.com/public/images/interview/22.png)
Answer:
The pop() method is similar as the shift() method but the difference is that the Shift method works at the start of the array. Also the pop() method take the last element off of the given array and returns it. The array on which is called is then altered.
Example:
var cloths = ["Shirt", "Pant", "TShirt"];
cloths.pop();
//Now cloth becomes Shirt,Pant
Example:
var cloths = ["Shirt", "Pant", "TShirt"];
cloths.pop();
//Now cloth becomes Shirt,Pant
Download Expert JavaScript Developer Interview Questions And Answers
PDF
Previous Question | Next Question |
What is event bubbling, and why is it beneficial to use? | How can I set up my own JavaScript error handler? |