To copy an Array in Javascript there are below Options
1. Using slice
const oldArray = ["value1","value2","value3"];
const newArray = oldArray.slice();
2. ES6 using spread(fails incase of mutli level deep Object)
const oldArray = ["value1","value2","value3"];
const newArray = [...oldArray ];
3. Using Array.from
const oldArray = ["value1","value2","value3"];
const newArray = Array.from(oldArray);
1. Using slice
const oldArray = ["value1","value2","value3"];
const newArray = oldArray.slice();
2. ES6 using spread(fails incase of mutli level deep Object)
const oldArray = ["value1","value2","value3"];
const newArray = [...oldArray ];
3. Using Array.from
const oldArray = ["value1","value2","value3"];
const newArray = Array.from(oldArray);