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?

Krokodil
  • 1,165
  • 5
  • 19

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,657
  • 4
  • 14
  • 23