Explain what is pop()method in JavaScript?

Asked: Apr 14, 2023

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 by brijesh

Answers (0)

No answers yet. Be the first to answer!