Unexpected nested loop behavior in javascript -
I am implementing in a way, and I have run some unforeseen behavior:
Var searches = ['beta', 'alpha']; Var i = 0; J = 0; (I = 0; i & lt; search.length; i ++) for {min = i; // Through the first time, i = 0 warning (i); For (J = I; J & LT; Searches; Long; J ++); {// First through Jammu 2. If I = 0, then how is J = 2? Warning (j); // Sort code}} In fact, which is always 2. When this is not set to Jammu on entering the loop?
Here is JSField:
You have a semi-colon at the wrong place :
for (j = i; j and lt; searches; length; j ++); // & lt; - The remainder is interpreted as a block that executes the loop after (when j == 2 ) . Take it out and it works fine and it works fine.
Comments
Post a Comment