Open kartamyshev opened 4 years ago
const array1 = [1, 2, 3]; const array2 = [2, 30, 1]; mergeUniq(array1, array2); // [3, 2, 30, 1]
function mergeUniq (arr1, arr2) { const concattedArray = arr1.slice(); for (const item of arr2) { if (!arr1.includes(item)) concattedArray.push(item); } return concattedArray; }