Given a list of integers and a single sum value, return the first two values (parse from the left please) in order of appearance that add up to form the sum. CodeWars kata link
Note: The following solution is not by me. It was one of the first solutions in the showcase under 'Solutions'. Apologies for not attributing the authors.
var sum_pairs = function (ints, s) {
var seen = {}
for (var i = 0; i < ints.length; ++i) {
if (seen[s - ints[i]]) return [s - ints[i], ints[i]];
seen[ints[i]] = true
}
}