What is the purpose of the break statement in JavaScript loops?

  • To exit the current loop and continue with the next iteration
  • To end the entire program
  • To pause the loop temporarily
  • To restart the loop from the beginning
The break statement in JavaScript is used to exit the current loop prematurely and continue with the next iteration of the loop or code block. It doesn't end the entire program or restart the loop from the beginning. It's a useful tool for controlling the flow of loops.
Add your answer
Loading...

Leave a comment

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