break Statement in JavaScript

The break statement or keyword in JavaScript is used to jump out from the current loop. For example:

HTML with JavaScript Code
<!DOCTYPE html>
      for(let i=0; i<=10; i++)

The output produced by above JavaScript example on break statement is:

js break statement

As you can see from the above example, if the value of i becomes 4, then the break statement gets executed to break out from the current loop or to stop the execution of the current loop.

JavaScript break Syntax

The syntax of break statement in JavaScript, is:


Note - The break Vs. continue in JavaScript is described in its separate tutorial.

JavaScript Online Test

« Previous Tutorial Next Tutorial »

Liked this article? Share it!

Like/follow us on social media for updates!