Javascript break statement
Notes:
JavaScript Jumping / Control transfer Statements :
To make the control jump / transfer directly from one place to another, we use JavaScript jumping or control transfer statements.
break,
continue,
function call,
return
JavaScript break statement: It terminates the loop
Browser skips statement(s) under the break statement, and transfers the control to the end / outside of the loop (nearest) or switch case.
Break statement is used inside switch and looping statements
Syntax:
break;
Ex:
for( var i=1; i<=5; i++ )
{
if(i==3)
{
break;
}
document.write(“Hello World <br/>”);
}
Interview Questions: