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) ![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUuCy5OnsmZKkDHs2dOSgEELT7szVK77Ni0N5AmlN9_kZtjgIs9SI6csi1IbyK9UFoxGPRFHNtOCDlMPsIkaEnrnk9sAyjo0SBtlLa2NVFC1U2RsZchJvvRt62qgLuSTAJu7nxT6Ggzy7W/s320/Loading+Code.GIF)
Editor is Loading...
Output:-
Advertisement
Post a Comment for "Label and Break in javascript"