Code review request: Pairwise

Hi All,

I’ve just completed this challenge and I would like feedback on my solution.

Here is my code.

function pairwise(arr, arg) {  
let indexes = new Set();  
for (let i = 0; i < arr.length-1; i++){ 
       for (let j = i+1; j < arr.length; j++){
        if (!indexes.has(i) && !indexes.has(j)){ 
         if (arr[i]+arr[j]==arg){
            indexes.add(i);
            indexes.add(j);
          } 
       }
      }
 }    
let sum  = [...indexes].reduce((acc,curr)=>{
    return acc + curr;  },0)    
return sum;
}

Hello, Elijah.

I have edited your post for readability. In future posts, please place all of your code within backticks.
If your code is on one line such as this x=1; then you can use a pair of single backticks. If your code spans over multiple lines as your post above, please place 3 backticks before and after.

This forum uses the MarkDown text syntax. Please conform to this, in order to keep posts tidy and legible.

Thank you. Will do so in the future.