title: Why an empty array in javascript entering for loop?
body: <p>I have following code snippet:</p>
  
  <pre><code>console.log('**1**',parentNode.child.length); //1
              for(var ch in parentNode.child)
              {
                  console.log('PTree root child',parentNode.child[ch]); //2
              }
  </code></pre>
  
  <p>In //1 parentNode.child.length comes out to be 0
  but still it goes inside the for loop and gives following output in line //2:</p>
  
  <pre><code>PTree root child (val) {
          if (this.indexOf(val) === -1) {
              this.push(val);
          }
  
          return this;
      }
  </code></pre>
  
  <p>I am not sure why it is happening.</p>