javascript deep clone array without reference code example
Example 1: angular clone array without reference
const myClonedArray = Object.assign([], myArray);
Example 2: deep clone array in javascript
const numbers = [1, [2], [3, [4]], 5];
// Using JavaScript
JSON.parse(JSON.stringify(numbers));
// Using Lodash
_.cloneDeep(numbers);
Example 3: angular clone array without reference
const myClonedObject = Object.assign({}, myObject);