for (let i = 0; i < 10; i++) {
if (i === 3) { break; }
text += "The number is " + i + "<br>";
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<button onclick="breakStatementExample()" id="btnClick">Click</button>
<script>
function breakStatementExample()
{
var x;
for ( x=0; x<=15; x++) {
if(x==10)
{
break;
}
if (x === 0)
{
document.write(x +" "+ "is"+" " + "an" + " " + "even number"+ "<br>");
}
else if (x % 2 === 0) {
document.write(x + " "+ "is"+ " " + "an" + " " + "even number"+ "<br>");
}
else {
document.write(x + " "+ "is"+ " " + "a" + " " + "odd number"+ "<br>" );
}
}
}
</script>
</body>
</html>