What you are misunderstanding is that, arr
is only the array [1, 2, 3, 1, 2, 3]
.
Which means, first parameter is the value which is passed in first.
What I mean is, arr
will be the first argument which comes before the first ,
.
In this case that the first argument is an array [1, 2, 3, 1, 2, 3]
so arr
is it.
But if I call the function like destroyer([[1, 2, 3], [1, 2, 3]], [1, 2, 3]);
, arr
will be [[1, 2, 3], [1, 2, 3]]
.
Here for more: Can someone explain a line of code in intermediate-algorithm-scripting 3rd challenge("Seek and destroy") - #5 by AndrewAung11