The "A. Using Spread" example fails to demonstrate the error, since it says return [...array1, array2] instead of return [...array1, ...array2] (it doesn't actually spread the string)
Instead it demonstrates the happy path of "immutably pushing" the string.
I firmly believe concat is dangerous and should only be used with arrays, not loose elements. Because your loose element will end up being an array someday, and you will SUFFER.
And on the other hand, it doesn't work on arraylikes:
The "A. Using Spread" example fails to demonstrate the error, since it says
return [...array1, array2]
instead ofreturn [...array1, ...array2]
(it doesn't actually spread the string)Instead it demonstrates the happy path of "immutably pushing" the string.
I firmly believe
concat
is dangerous and should only be used with arrays, not loose elements. Because your loose element will end up being an array someday, and you will SUFFER.And on the other hand, it doesn't work on arraylikes:
Oops, that’s a typo 😬 let me fix that 😰