I first learned basic array methods several months ago. I learned them, I moved on, and I forgot them.
So – I didn’t really learn them. In fact, I could never remember the difference between pop and push, and shift and unshift. Which ones were additive and put more stuff in the array, and which ones were subtractive and took stuff away from the array? Which ones added elements to the beginning of the array, and which ones added elements to the end of the array?
Finally, I got fed up trying to remember these abstract words, so I made myself a cheatsheet that associated these new concepts with an familiar existing concept in my brain – a rainbow.
Note: this only covers, pop, push, shift, and unshift. There are more array methods to learn. Here are some resources:
- https://www.geeksforgeeks.org/javascript-basic-array-methods/
- https://www.w3schools.com/js/js_array_methods.asp
Pop, Push, Shift, Unshift








And the thing that confused me the most? Why “shift” and “unshift”?
Great question. Your guess is as good as mine. It was a big part of the reason why these four basic array methods were so hard to memorize.
Here is a good guess from someone on Quora.
And since it’s Quora, see next year, Harry.
