<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript break with labelled block</title>
</head>
<body>
<pre> <!-- Use pre element for work document.writeln() method -->
<script>
outer: {
document.writeln("Inside outer start");
inner: {
for(var i = 1; ;) {
while(i <= 5){
document.writeln("i : " + i); // execute until i = 3
if (i == 3){
document.writeln("Skipped inner");
break inner; // skip inner block
}
i++;
}
}
}
document.writeln("Inside outer end");
}
</script>
</pre>
</body>
</html>