Exemple do while

<!DOCTYPE html>
<html>
<body>

<p>Click the button to loop through a block of code as long as i is less than 10.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var text = "";
    var i = 10;
    do {
        text += "<br>The number is " + i;
        i++;
    }
    while (i < 10);  
    document.getElementById("demo").innerHTML = text;
}
</script>

</body>
</html>