Label and Break in javascript

     Any identifier can use as label name. We can use a label to identify a loop and use the break statements to interrupt the execution.

Example

golabel:{
  var i=10;
  var j=15;
  break golabel;
  var k=100; //Will not execute
}


Example Program:- (Editor)


Editor is Loading...

Advertisement

0 nhận xét:

Đăng nhận xét