title: Determine whether an array contains a value
body: <p>I need to determine if a value exists in an array.</p>
  
  <p>I am using the following function:</p>
  
  <pre><code>Array.prototype.contains = function(obj) {
      var i = this.length;
      while (i--) {
          if (this[i] == obj) {
              return true;
          }
      }
      return false;
  }
  </code></pre>
  
  <p>The above function always returns false.</p>
  
  <p>The array values and the function call is as below:</p>
  
  <pre><code>arrValues = ["Sam","Great", "Sample", "High"]
  alert(arrValues.contains("Sam"));
  </code></pre>