r/javascript • • Mar 24 '18

Can't keep Array.shift vs Array.unshift straight? (NSFW) NSFW

Here is a helpful, although gross mnemonic to help keep the two straight in your head. Drop the "f".

So, Array.shit() drops a load (element) from the beginning of an array and Array.unshit() will do the opposite.

69 Upvotes

31 comments sorted by

View all comments

2

u/darkde Mar 24 '18

I just memorized that adding methods have a 'u' and removing doesnt