Arrays are always passed by reference, so when you insert array2 into array via:
array = [array2, 1]
You’re not inserting a copy of array2, that’s just a reference to the one, single array2 instance.
So, when you update the first element of array2, that change is also reflected in array, since it just contains a reference to (the now changed) array2.
I’m not sure what you’re trying to do, but if you want to insert a copy of array2 into array, you can use the array’s duplicate() function`. See the docs here:
Thank you! The duplicate() function worked!
stevepetoskey | 2020-11-05 21:45
If it worked, you may select the answer so others can see that it solved your issue.