``````const findSum = (arr, val) => {
let start = 0;
let end = arr.length - 1;
while (start < end) {
let sum = arr[start] + arr[end];
if (sum > val) {
end -= 1;
} else if (sum < val) {
start += 1;
} else {
return true;
};
};
return false;
};

// Tests below
describe('findSum', function() {

it('returns TRUE if adding two numbers in an array yield the given value', () => {
expect(findSum([1, 2, 4, 4], 8)).toEqual(true);
});

it('returns FALSE if adding two numbers in an array does not yield the given value', () => {
expect(findSum([1, 2, 5, 9], 8)).toEqual(false);
});

it('does not count any value twice', () => {
expect(findSum([1, 2, 4, 9], 8)).toEqual(false);
expect(findSum([1, 2, 5, 6], 12)).toEqual(false);
});

it('can handle negative values', () => {
expect(findSum([-2, 1, 1, 4], 2)).toEqual(true);
expect(findSum([-3, -2, 1, 4], -5)).toEqual(true);
expect(findSum([-7, -3, -2, -1], -8)).toEqual(true);
});

it('can handle zero values', () => {
expect(findSum([-2, 0, 0, 1], 0)).toEqual(true);
expect(findSum([0, 0, 0, 0], 0)).toEqual(true);
expect(findSum([-1, 0, 1, 2], 0)).toEqual(true);
});
});``````