2 ms·
Yes append() and prepend() would be much better names than push() and unshift(). IF JavaScript had them as built-ins it would be great, then I wouldn't need to
by galaxyLogic 3y ago
Yes append() and prepend() would be much better names than push() and unshift().
IF JavaScript had them as built-ins it would be great, then I wouldn't need to look for mnemonics for shift() and unshift() :-)
But, I googled "prepend" and guess what: google replied
"Although it sounds correct, prepend is not an English word. It was created to sound like the opposite of "append," which means to add to the end. The correct English word is "prefix".
A slight problem with that is that "prefix" is more often used as a noun than as a verb, I think.
- brudgers 3y ago"Prepend" might not be queen's English. I'm American so so what. Anyway, "cons" is a better term in technical contexts.