title: JavaScript Loops: for...in vs for
body: <p>I faced a strange behaviour in Javascript. I get</p>
  <blockquote>
  "Object doesn't support this property or method"
  </blockquote>
  <p>exception for the <code>removeAttribute</code> function in the following code:</p>
  <pre><code>var buttons = controlDiv.getElementsByTagName(&quot;button&quot;);
  for ( var button in buttons )
      button.removeAttribute('disabled');
  </code></pre>
  <p>When I change the code with the following, the problem disappears:</p>
  <pre><code>var buttons = controlDiv.getElementsByTagName(&quot;button&quot;);
  for ( var i = 0; i &lt; buttons.length; i++ )
      buttons[i].removeAttribute('disabled');
  </code></pre>
  <p>What is the value of <code>button</code> inside the <code>for...in</code>?</p>