Break statement in a if statement : Break « Statement « JavaScript Tutorial





<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
var x = 0, breakat;
breakat = prompt("Pick a number between 1 and 10 to break at", "");
while (x < 10) {
    if (x == breakat)
        break;
    }
    document.write(x);
    x++;
}
//  -->
</script>
</head>
<body>

</body>
</html>










3.9.Break
3.9.1.break statement syntax
3.9.2.Break a while statement
3.9.3.Break statement in a if statement