let arr1 = [1, 2, 3, 4, 5];
let arr2 = arr1;
console.log(arr1 === arr2);
arr1 = [1, 2];
console.log(arr1 === arr2);
console.log('array1 ', arr1);
console.log('array2 ', arr2);
if array is reference type, so arr2 value should be change
Via Active questions tagged javascript - Stack Overflow https://ift.tt/qdi0tcr
Comments
Post a Comment