Hey explain example JS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Hey explain example JS

Why output 5 if we have condition <5? Its do i++ sou works on output? https://code.sololearn.com/Wai9Bk0oaWTf/?ref=app

1st Jul 2019, 1:48 PM
Knozi
Knozi - avatar
2 Answers
+ 5
When i becomes 5 then only the condition fails because in do while loop first we execute statement then we check condition.
1st Jul 2019, 1:54 PM
Nandini
+ 5
You're right P.Nandini
1st Jul 2019, 2:08 PM
CodeFu
CodeFu - avatar