Break in JavaScript


In JavaScript, the "break" statement is a control flow statement that allows you to exit or terminate a loop or switch statement prematurely. When the "break" statement is encountered within a loop or switch, the program immediately exits that loop or switch, and execution continues with the next statement after the loop or switch block.

Source Code

HTML Code
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Tutor Joes</title>
</head>
<body>
 
	<script src="js/script.js"></script>
</body>
</html>
To download raw file Click Here

script.js
for(let i=1;i<=10;i++)
{
  console.log(i);
  if(i==4){
    break;
  }
}
To download raw file Click Here

List of Programs


JS Practical Questions & Answers


JS Practical Project