title: Javascript: hiding prototype methods in for loop?
body: <p>So lets say I've added some prototype methods to the Array class:</p>
  
  <pre><code>
  
  Array.prototype.containsKey = function(obj) {
      for(var key in this)
          if (key == obj) return true;
      return false;
  }
  
  Array.prototype.containsValue = function(obj) {
      for(var key in this)
          if (this[key] == obj) return true;
      return false;
  }
  
  </code></pre>
  
  <p>then I create an associative array and attempt to loop through it's keys:</p>
  
  <pre><code>
  
  var arr = new Array();
  arr['One'] = 1;
  arr['Two'] = 2;
  arr['Three'] = 3;
  
  for(var key in arr)
     alert(key);
  
  </code></pre>
  
  <p>this returns five items:</p>
  
  <pre>
    -One
    -Two
    -Three
    -containsKey
    -containsValue
  </pre>
  
  <p>but I want (expect?) only three.  Am I approaching this wrong?  is there a way to "hide" the prototype methods?  or should I be doing something differently?</p>