Reputation: 18781
Just a thought experiment .. no use case
concat docs
Note: Concatenating array(s)/value(s) will leave the originals untouched. Furthermore, any operation on the new array will have no effect on the original arrays, and vice versa.
Is there a function to make a copy an array that could have an effect on the original arrays, and vice versa?
example:
var data = [1,2,3]
var copyData = makeCopy(data);
if data changes so does copyData and vice versa.
what would be a practical use case for this?
Upvotes: 1
Views: 36
Reputation: 490153
Once you make a copy on an array, it won't ever affect the original array.
However, this doesn't apply to what the array points to, which may be objects.
Upvotes: 2