Hello. Could somebody help me pinpoint where I went wrong with the following code? I feel it should work. Thanks!
function pairwise(arr, arg) {
var totalSum = 0;
var sum = 0;
var repeatedNum = [];
for (var i = 0; i <arr.length-1; i++) {
for (var j = i+1; j < arr.length; j++) {
if (arr[i] + arr[j] === arg && repeatedNum.indexOf[i] == -1 && repeatedNum.indexOf[j] == -1) {
sum = i + j;
totalSum += sum;
repeatedNum.push(i);
repeatedNum.push(j);
}
}
}
return totalSum;
}
pairwise([1,4,2,3,0,5], 7);