Tell us what’s happening:
I have figured out a solution and found out where the mistake (syntax) lies. But I can’t figure out why the brackets are needed here. I’d like an explanation to understand the difference between.
Crucial part of my code that doesn’t work :
newArr = [...newArr,...arr];
But it is accepted like this :
newArr = [...newArr,[...arr]];