javascript - Why is my for-in loop is looping double the size of my array? -


I am using an in-in loop to be an array of two elements, but this is twice Its like looping. / P>

I have an example here:

This is because the result is GetElementsByTagName is not a simple array - it's a nodelist and it's "live"

You can specify the nodelist in the array To turn on, use the "slice" method on the array prototype:

  Var slideer = [] .slice.call (slide, 0);   

In addition to this, you should be repeated with a numeric index with the array (or nodist for that node):

 For  (var slideIndex = 0; slideIndex & lt; slideAlline; ++ slideindex) {   

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -