while and do/whileWhatever is inside the do while loop will run once even if the condition given is false. A while loop would not run the code at all if the condition is false.
let total = 0;
let i = 0;
do { // the code will run even though i > 5 is not true
total += i;
i++;
} while (i > 5);
<aside> ⚖️ Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License.
If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact [email protected] for inquiries.
</aside>