function arrayContains(array, element) {
    var i = -1,
        length = array.length;

    // Special handling for NaN
    if (element !== element) {
      while (++i < length) {
        if (array[i] !== array[i]) {
          return true;
        }
      }
      return false;
    }

    while (++i < length) {
      if (array[i] === element) {
        return true;
      }
    }
    return false;
  }
Checks if an element exists in an array.

@private
@param {Array} array
@param {*} element
@returns {boolean} Whether or not the element exists in the array.

@examples
arrayContains([1, 2], 2)              // => true
arrayContains([1, 2], 3)              // => false
arrayContains([undefined], undefined) // => true
arrayContains([NaN], NaN)             // => true