A program to tell you if there are 2 numbers in an array that add to a given sum there is a video on life at google about what an interview would be like and so i watched it and decided to go along and come up with a solution to the problem myself and i found it really easy this is the solution i came up with

the question is to make a program to find 2 numbers in an array that add up to a sum return true if two such numbers exists return false if they do not

var gotPair = function(arr, sum) {
  this.data = arr;
  this.sum = sum
  this.check = [];
  this.num = null;
  this.out = false;
  for (var i = 0; i &lt; this.data.length; i++) {
    this.num = this.sum - this.data[i];
    if (check.includes(this.num)) {
      this.out = true;
    }
    this.check.push(data[i]);
  }
  return this.out;
}


did i do a good job?
i made sure it always worked so tell me if its good.
i currently want to work for google and i am 14 so anyone who can help me get there i would be very grateful
There are a few problems with the function right now. 


gotPair leaks variables to the global scope. When you say this.data, this refers to the global scope so you create a global property called data. See How does the "this" keyword work? on SO. 
Instead of storing an out variable, you can just return true when you find a match. This both reduces the complexity of the function and improves the speed. Imagine you have an array of 10 billion elements and you find the match in the first 2 elements. There's no need to go through the rest of the array. 
Avoid creating variables you don't need. this.data is just arr, num isn't necessary as the subtraction can be performed in the call to includes, this.sum is the same as sum, and check is not needed as it is just a copy of arr from index 0 to i. 


Here are a few alternative implementations. 

Similar to your logic, but looping backwards so that we can take advantage of the fromIndex argument of the includes function. I've included type checks in this function to show how they might be done, but some people prefer to leave them out in Javascript and let the function throw "naturally". 

function hasSumPair(arr, sum) {
    if (!Array.isArray(arr)) throw new Error('The first argument must be an array')
    if (Number.isNaN(sum)) throw new Error('The second argument must be a number')

    for (let i = arr.length - 2; i &gt;= 0; i--) {
        if (arr.includes(sum - arr[i], i)) {
            return true
        }
    }
    return false
}


Explicitly looping through the array twice. This makes what the function is doing very clear but results in code that is somewhat uglier. 

function hasSumPair(arr, sum) {
    for (let i = 0; i &lt; arr.length; i++) {
        for (let j = i + 1; j &lt; arr.length - 1; j++) {
            if (arr[i] + arr[j] === sum) {
                return true
            }
        }
    }
    return false
}


Here is a one liner that will have some problems with very large arrays since it will copy the array for each run. 

function hasSumPair(arr, sum) {
    return arr.some((num1, index) =&gt; arr.slice(index + 1).some(num2 =&gt; num1 + num2 === sum))
}


This implementation is not the fastest as it has to sort the array first. If you can assume that the array is sorted, this would be the fastest solution (which is often very important at interviews for companies like Google)

function hasSumPair(arr, sum) {
    // .sort() mutates the array, so copy it using .slice() first.
    let sorted = arr.slice().sort()
    for (let i = 0; i &lt; sorted.length - 1; i++) {
        for (let j = i + 1; j &lt; sorted.length &amp;&amp; sorted[j] + sorted[i] &lt;= sum; j++) {
            if (sorted[j] + sorted[i] === sum) {
                return true
            }
        }
    }
    return false
}


The same function as above, but making use of some (Note that on the last iteration, arr[i + 1] will be undefined which will result in a NaN result and will work as expected). This is likely the implementation I would use if the array is sorted, and likely even if the array isn't sorted if the speed is not an issue. 

function hasSumPair(arr, sum) {
    return arr.slice().sort()
        .some((a, i, sorted) =&gt; sorted.slice(i).some(b =&gt; a + b == sum))
}


Which of these functions is best is largely a matter of opinion and the case in which it will be used. Most of the time I recommend choosing readability over speed. Speed should only be considered if the time it takes to run the function is creating problems.