typescript copy array by value code example
Example 1: angular clone array without reference
const myClonedArray = Object.assign([], myArray);
Example 2: copy array javascript
const sheeps = ['Apple', 'Banana', 'Juice'];
// Old way
const cloneSheeps = sheeps.slice();
// ES6 way
const cloneSheepsES6 = [...sheeps];
Example 3: javascript copy array
var numbers = [1,2,3,4,5];
var newNumbers = Object.assign([], numbers);
Example 4: angular clone array without reference
const myClonedObject = Object.assign({}, myObject);