Jason Knight
1 min readJan 6, 2021

--

You say a number of things -- not necessarily right or wrong -- without saying WHY. You use authoritative speech without explanation.

WHY should we stop using arguments. They are functionally identical, arguments exists anyways, so if ALL the parameters are varidic, what's the difference?

There is good reason to favor "rest", such as if you have a couple of fixed parameters before the variable ones:

function (something, somethingElse, ...rest)

Then sure, But if they're all variable there's no reason to hop up and down yelling "don't use the arguments array"

Like that bizzaro convoluted code under "never modify arguments" -- which is total nonsensical gibberish. The problem there isn't modification of arguments, it's that whatever the blazes it is you're trying to do with arguments is junk code that OF COURSE doesn't work. What possible reason could you have for that garbage const and shifting of a COPY of arguments? It's not that you can't modify arguments, it's that you're not actually shifting arguments you're shifting a COPY of it! Gee you try to treat a non-array-like as an array without copying it to an array and it ****'s up. Who knew?!? (sarcasm)

Which is actually in this case where "rest" is of course superior... but you don't actually SAY that.

--

--

Jason Knight
Jason Knight

Written by Jason Knight

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse

No responses yet