copy array javascript instead of reference code example
Example: javascript copy an array
let arr =["a","b","c"];
// ES6 way
const copy = [...arr];
// older method
const copy = Array.from(arr);
let arr =["a","b","c"];
// ES6 way
const copy = [...arr];
// older method
const copy = Array.from(arr);