The do...while Loop
The do...while loop is similar to the while loop except that the condition check happens at the end of the loop.
This means that the loop will always be executed at-least once, even if the condition is false.
In this example we write the condition so that it always evaluates to false to illustrate the workings of the do...while loop https://raw.githubusercontent.com/finsweet/jqueryCourse/main/loops/ex3.js?actionable=true
In this example the output of the web page will be:CurrentCount : 0
This is the output because the script executes the document.write() and increases the count by 1 before checking if the count is less than 0. Since this condition evaluates to false, the while loop will end with just one execution.
$(document).ready(function(){
XT1
});
</script>
Live demo
<div id="minidivpage" class="example-live"><div id="resultdiv"></div></div>
$(document).ready(function() {
XT1
});
</script>