The 'do while' loop

Published on: April 26, 2017

Welcome to the 25th Easy JavaScript tutorial, part of  In this tutorial, we cover the 'do while' loop. 

If you haven't already, I would highly recommend that you watch my "do while" loop tutorial in C++.

It's a very old tutorial, but it's still relevant because the syntax of a do-while loop in C++ is the exact same as JavaScript. 

The do while loop allows you to run a block of code as long as a specific condition is true. Unlike the while loop, the do while loop will ALWAYS run at least once before it checks the condition.

Let's take a look at the Syntax of the do while loop:

    code to be executed - this code is run at least once
  } while (condition is true);

To fork the fiddle and follow along:


Remember to checkout the Resources section below for associated downloadable content, JSFiddle links, and other resources. Watch the video and follow along!