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

Nhận xét

Bài đăng phổ biến từ blog này

Tourist places in kk district:1) Thiruvalluvar statue

Variable in CSS

How to set multiple images in a loop javascript?