Question · JavaScript and TypeScript course · Module 5: Advanced JavaScript
Array Methods in Practice - shift and unshift
What is the difference between shift() and unshift() in arrays?
Answer options
- shift() adds an element to the beginning, unshift() removes from the beginning
- shift() removes an element from the beginning, unshift() adds to the beginning
- Both do the same thing
- shift() and unshift() work with the end of the array
You can check the correct answer by solving this task in the CodeWorlds game.