Learn JavaScript
Lesson 1 - Introduction To JavaScript
Lesson 2 - Basic JavaScript Syntax
Lesson 3 - Control Flow
Lesson 4 - Functions
Lesson 5 - Basic Data Structures
Lesson 6 - Basic String Operations
Lesson 8 - Exception Handling
Lesson 9 - Packages
Lesson 10 - User Input
The function pop()
returns the last element of an array and deletes it. For example:
let fruits = ['Apple', 'Banana', 'Orange']; console.log(fruits.pop()); // Output: Orange console.log(fruits);
Here, fruits.pop()
returns the last value of the array fruits
and then removes it from the array.
Try to pop()
another item from the array fruits
: