Solution for Pairwise

What is your hint or solution suggestion?

function pairwise(arr, arg) {
  let pairsArr = [];
  let usedIndices = []
  for(let i = 0; i <= arr.length ; i++){
    for(let j = 0; j <= arr.length ; j++){
      if((arr[i] + arr[j]) == arg && i != j){
        if(!usedIndices.includes(i) && !usedIndices.includes(j)){
          pairsArr.push([i,j])
          usedIndices.push(i,j)
        }
      }
    }
  }
  
  let sumArr = pairsArr.length > 0 ?
    pairsArr
      .map(p => p[0]+ p[1])
      .reduce((sum,acc) => sum + acc) 
    :0;
  return sumArr
}

pairwise([1,4,2,3,0,5], 7);

Challenge: Pairwise

Link to the challenge: