title: Error: Infinity loop recursion javascript
body: <p>I am beginner javascript. I tried to debug my function browseDom. When it runs to node head[2]=text, mean i=2. I think it will continue with i=3 at head parent but I don't understand why i=0???</p>
  
  <p><a href="https://i.stack.imgur.com/dTLVK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dTLVK.png" alt="enter image description here"></a></p>
  
  <pre><code> function browseDom(parent){
              i=0;
              while(parent.childNodes[i]){
                  browseDom(parent.childNodes[i]);
                  i=i+1;
              }
      }
  </code></pre>