title: about optimizing for-in statement
body: <p>I read an article named Optimization killers, and in <a href="https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#523-the-object-contains-enumerable-array-indices" rel="nofollow">5.2.3. The object contains enumerable array indices</a>, It says :</p>
  
  <blockquote>
    <p>Workaround: Always use Object.keys and iterate over the array with for loop. If you truly need all properties from entire prototype chain, make an isolated helper function:</p>
  </blockquote>
  
  <pre><code>function inheritedKeys(obj) {
      var ret = [];
      for(var key in obj) {
          ret.push(key);
      }
      return ret;
  }
  </code></pre>
  
  <p>I don't understand what it means.
  In the above code, there is still a <code>for...in</code>, so function inheritedKeys can't be optimized, how can it be an isolated helper function?</p>