break in javascript

     The break statement totally break the loop, in the following example write a for loop for execute 10 times but when the i value is come 3 the loop will totally terminated.

Example

for (i = 0; i < 10; i++)
{

  if (i == 3)
  {

    break; //Terminate the for loop

  }

  alert(i);

}



Example Program:- (Editor)


Editor is Loading...

Advertisement



Tags:
break statement in allinworld99,break in allinworld99

0 nhận xét:

Đăng nhận xét