I do have two arrays
arr1 = [1,2,3,4] //readonly array
arr2 = [1,2,3,4,5,6,7]
arr1 is the main array and I want to update it with contents from arr2 so that when i log arr1 it will display
[1,2,3,4,5,6,7]
is there a way I can do this
>Solution :
let arr1 = [1,2,3,4];
let arr2 = [1,2,3,4,5,6,7];
arr1 = [...new Set([...arr1 ,...arr2])];
console.log(arr1); // [1,2,3,4,5,6,7]