JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JavaScript

What is the pop()method in JavaScript?

3rd Oct 2019, 7:52 AM
Zenande Zilwa
Zenande Zilwa - avatar
2 Answers
+ 7
The pop() method removes the last element of an array, and returns that element. var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.pop(); output Banana,Orange,Apple
3rd Oct 2019, 8:01 AM
Nahidul Islam
Nahidul Islam - avatar
+ 2
pop() removes the last element of an array and returns it.
3rd Oct 2019, 7:58 AM
xyz$