Which array method removes the first element from an array and returns that removed element?
- shift()
- unshift()
- pop()
- push()
The array method that removes the first element from an array and returns that removed element is shift(). It shifts all other elements to a lower index, effectively removing the first element. The unshift() method adds elements to the beginning, pop() removes the last element, and push() adds elements to the end of the array.
Loading...
Related Quiz
- When you want to store multiple values in a single variable, you should use a(n) _________.
- What is the primary difference between while and do-while loops in JavaScript?
- What was the original name of JavaScript?
- What is the drawback of using "inheritance" through the prototype chain?
- The ________ interface provides methods to deal with HTTP responses represented in binary format.