Is there any more efficient way to code this “2 Sum” Questions
Variables tempA, index1 and index2 seem to be unused.

Since you are only interested in if(j - i &gt; 0){, you can start right there
for (int j  = i + 1; and omit the conditional.

Further the condition if(j &lt; Results[1] || Results.length == 0){ should be flipped around to if(Results.length == 0 || j &lt; Results[1]){ to avoid accessing undefined index.

But actually the variable Results is uselesss because you can return the pair as soon as you find it. Just iterate in the desired directions.

function twoSum(input, targetSum){
  const limit = input.length;
  for(var j = 1; j &lt; limit; ++j){
    var temp = targetSum - input[j];
    for(var i = 0; i &lt; j; ++i){
      if(temp == input[i]){
        return [i + 1, j + 1];
      }
    }
  }
  return [];
}