Finding all pairs of elements in an array that sum to a target value
No, each number requires a second pass to determine whether combined with an existing one it is a match - doesn't mean it can't be short though e.g.

const checkIfSumFromTwoNumbers = (arrayOfNums, targetValue) =&gt; 
  arrayOfNums.reduce((matches, val) =&gt; {
      const target = arrayOfNums.find(x =&gt; (val + x) === targetValue);
      target &amp;&amp; matches.push([val, target]);
      return matches;
   }, [])




I was actually ignorant to the fact your code actually works which means it can be done in one pass :) here's a slightly neater / more concise version of what you already have:

const checkIfSumFromTwoNumbers = (arrayOfNum, targetValue) =&gt; {
  const seen = {};
  return arrayOfNum.reduce((matches, val) =&gt; {
    const delta = targetValue - val;
    seen[delta] &amp;&amp; matches.push([delta, val]);
    seen[val] = true;
    return matches;
  }, []);
};