JavaScript array push, pop, shift, unshift: how to remember the difference
If you want to add or remove items from the beginning or end of a JavaScript array, you'd use push, pop, shift, or unshift.
But how do you remember which is which?
Here's a handy guide:
Unshift and shift make the whole array shift sideways.
Unshift
Shift
Push and pop do NOT make the array shift sideways.
Push
Pop
In each of those pairs (push/pop and unshift/shift),
the longer word makes the array longer.