i need to copy array of objects without reference. I tried
newarr = arr.slice();
newarr = [...arr]];
But both of them have reference to object so when i change them in newarr it changes in arr aswell.
i need to copy array of objects without reference. I tried
newarr = arr.slice();
newarr = [...arr]];
But both of them have reference to object so when i change them in newarr it changes in arr aswell.