In JavaScript, a "do-while" loop is a control flow statement that allows you to repeatedly execute a block of code as long as a specified condition is true. It is similar to the "while" loop, but with one key difference: the "do-while" loop guarantees that the code inside the loop is executed at least once, even if the condition is false from the beginning.
Syntax:
do {
// Code to be executed
} while (condition) ;
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Tutor Joes</title> </head> <body> <script src="js/script.js"></script> </body> </html>To download raw file Click Here
/* do { // code to be executed if the condition is true } while (condition); */ let table=88;limit=5;i=1; do { console.log(table+" X "+i+" = "+(table*i)); i++; }while(i<=limit);To download raw file Click Here
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions