Did you read the comment of @josh
to which I replied?
Granted, the spread operator being used in the returned array like this means you'll be generating copies upon copies upon copies, but you asked for an arity-agnostic refactor, not a performant one 😜
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This instantiates n+1 new arrays (where n is the number of arrays), when you could have just used a for loop to instantiate 1 new array.
Did you read the comment of @josh to which I replied?