Explain what is pop()method in JavaScript?

0

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.
var cloths = ["Shirt", "Pant", "TShirt"];cloths.pop();
//Now cloth becomes Shirt,Pant

asked Apr 14, 2023 at 19:28
Sign in to add a comment

0 Answers

0
📝 No answers yet!

Be the first to answer this interview question.

Your Answer

Sign in to post your answer and help the community.