<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript break with try...catch...finally</title>
</head>
<body>
<pre> <!-- Use pre element for work document.writeln() method -->
<script>
try{
for(var i = 0; i < 5; i++){
document.writeln("i: " + i);
if (i == 3){
break;
}
}
}catch(e){ // Skip catch block
document.writeln(e.message);
}
finally{
document.writeln("last i: " + i);
}
</script>
</pre>
</body>
</html>