continue Archives - Ebhor.com Read The Latest Post Java, Css, Html, Php learning articles Fri, 27 Jan 2023 13:42:56 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 https://www.ebhor.com/wp-content/uploads/2021/05/ebhor_logo_100x.jpg continue Archives - Ebhor.com 32 32 Loop Control Statement in JavaScript https://www.ebhor.com/javascript-loop-control/ Thu, 26 Jan 2023 10:44:28 +0000 http://ebhor.com/?p=4463 The Break Statement The break statement can be used to jump out of a loop even when the condition is true. The break statement breaks the loop and continues executing all the code after the loop(if any): [crayon-663c16409ce60702325844/] OUTPUT [crayon-663c16409ce67242996818/] This time though, we want to stop execution of the loop when i become 3. To do so, we are ... Read more

The post Loop Control Statement in JavaScript appeared first on Ebhor.com.

]]>
The Break Statement
  • The break statement can be used to jump out of a loop even when the condition is true.
  • The break statement breaks the loop and continues executing all the code after the loop(if any):

OUTPUT

The number is: 0
The number is: 1
The number is: 2
The number is: 3
The number is: 4
The number is: 5

This time though, we want to stop execution of the loop when i become 3. To do so, we are inserting another conditional checking i, and if the test passes, we will break execution of the loop:





OUTPUT

The number is: 0
The number is: 1
The number is: 2

The Continue Statement

The continue statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop.




    


OUTPUT

The number is: 0
The number is: 1
The number is: 2
The number is: 4
The number is: 5

The post Loop Control Statement in JavaScript appeared first on Ebhor.com.

]]>