title: Forloop behaving weird in javascript but only in firefox and ie
body: <p>This works fine in chrome but not in ie or firefox when i trace this in firefox and put cursor on the i inside [i] it shows undefined.</p>
  
  <pre><code>var rect1 = document.getElementById(selectedObject).getBoundingClientRect();
  var nodes = document.getElementById('c').childNodes;
  for (var i = 0; i &lt; nodes.length ; i++) {
      //alert(nodes.length);
      //Don't check selectedObject with itself!
      if (nodes[i] == selectedObject || nodes[i] == undefined) {
          //   alert(nodes[i])
          // alert(selectedObject)
          continue;
      }
  }
  </code></pre>
  
  <p>inside [] i is undefined</p>
  
  <p><img src="https://i.stack.imgur.com/cBzPa.png" alt="enter image description here"></p>
  
  <p>outside [] i is 0</p>
  
  <p><img src="https://i.stack.imgur.com/3LPf5.png" alt="enter image description here"></p>