Home > front end >  The for loop, the loop nodelist why an infinite loop, a fine
The for loop, the loop nodelist why an infinite loop, a fine

Time:12-05

In the little red book, there is two chestnuts, borrow someone else's computer, mobile phone is too much trouble, bosses, excuse me a minute, this assignment len, if not infinite loop outside the for loop, I can understand, why the second wouldn't be an infinite loop, for len=divs. Length, not run get query all div elements?

CodePudding user response:

Lend the computer, mobile phone type too slow

CodePudding user response:

 for (let I=0, executed only once; Execution;) every time {

A comma len=divs. Length at the time of the initial written will only assign a
So divs. They changed the length is okay

CodePudding user response:

Because you are the first to create and access, so div. The length has been on the rise, while the second you assigned to the first to obtain the length length len, with len to compare, at this time whether div. What length change, len is constant,
  • Related