When you use […arr1] you copy the elements (it is a shallow copy, though, be careful if the elements aren’t basic types). The result is [ ‘JAN’, ‘FEB’, ‘MAR’, ‘APR’, ‘MAY’ ].
But [arr1] creates something very different [ [ ‘DEC’, ‘FEB’, ‘MAR’, ‘APR’, ‘MAY’ ] ], an array inside another array.
Try it in a node console. You’ll see something like this:
Hi, I am not understanding Spread Operator either.
I understand that let arr2=[arr1] will return this:
[[ ‘JAN’, ‘FEB’, ‘MAR’, ‘APR’, ‘MAY’ ]]
but
let arr2 = arr1 returns the same result as arr2= […arr1].
So why we should complicate…? Can you explain more simply… What is the difference, cause the result is the same to me…
Regards