jQuery out of each cycle: JS error: illegal break statement

Today the use jquery in JS in each write a simple loop, out of the loop when performing operations encountered JS error: Uncaught SyntaxError: Illegal BREAK of Statement

Illegal break statement, lead to execution errors.

Then look at the previous code:

if(flag){
  second = true;
  return false;
}

Wherein, return false equivalent to break;

It may be replaced with a continue return true.

Error is very simple, due to the effect coupled with the inertia of thinking, did not get it.

Here to remind myself to be a record.

 

Guess you like

Origin www.cnblogs.com/henuyuxiang/p/11809943.html