JavaScript's _________ statement is used to exit from a loop prematurely.

  • break
  • continue
  • exit
  • return
In JavaScript, the break statement is used to exit from a loop prematurely. When the break statement is encountered inside a loop, the loop immediately stops executing, and control is transferred to the statement immediately following the loop. This is commonly used to exit a loop based on a certain condition without completing all iterations. Understanding control flow statements like break is essential for writing efficient and structured code in JavaScript.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *