Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

break statement in javascript

// The break statement breaks out of a switch or a loop.

let text = "";
for (let i = 0; i < 5; i++) {
  if (i == 3) break;
  text += i;
}
// output: 012
 
PREVIOUS NEXT
Tagged: #break #statement #javascript
ADD COMMENT
Topic
Name
5+2 =