0

Paralel array

How do you make a copy of an array, but when the first array has changes, the copy doesn't receive those? (Like, you remove an element from the first array but the copy doesn't get the element removed)

25th Apr 2019, 11:50 AM
Ric2908
Ric2908 - avatar
1 Answer
+ 1
var copiedArray = originalArray.slice(); Slice () clones the array with references also one more way is iterating with loop https://code.sololearn.com/Wxl8PLTurX7n/?ref=app
25th Apr 2019, 11:58 AM
Melih Melik Sonmez
Melih Melik Sonmez - avatar