1

Is there any real difference between do-while loops and while loops in Javascript? I know that do-while executes the code block before checking the condition, and while checks the condition first, but are there any other differences like performance?

AlphaHowl
  • 1,063
  • 5
  • 17

1 Answers1

1

Yes, as you said do-while will execute the code block at least once even when the condition fails.

Other than functional difference, there should be no performance difference.

Check out this answer.

NcXNaV
  • 1,601
  • 4
  • 12
  • 22