The _______ method is used to remove the last element from an array in JavaScript.
- pop
- removeLast
- deleteLast
- splice
The correct option is "pop." In JavaScript, the "pop" method is used to remove the last element from an array and returns that element. This method modifies the array it is called on. The other options ("removeLast," "deleteLast," and "splice") either do not exist as array methods in JavaScript or do not specifically remove the last element from an array.
Loading...
Related Quiz
- How would you optimize a SQL query that is running slow on a large dataset?
- Explain the concept of prototypal inheritance in JavaScript.
- The ___________ algorithm is used to find the shortest paths between nodes in a weighted graph.
- What is the function of an inode in a Unix-like file system?
- Which data structure resembles the behavior of a stack?