Hello FCC campers, well i want to display sum of same numbers in the two arrays, some i did comparison then sum but my code won’t work !!
let arr1 = [2, 7, 5];
let arr2 = [3, 7, 5];
let totArr = 0;
/*function distinctElement(arr){}*/
for(let i = 0; i < arr1.length; i++){
totArr = arr[i];
for(let j=0; i < arr2.length; j++){
if(arr1[i] == arr2[j]){
totArr = arr[i] + arr[j];
}
}
}
console.log(totArr)