a while loop is a control flow statement that allows you to repeatedly execute a block of code as long as a specified condition evaluates to true. It is one of the fundamental loop constructs in JavaScript and is used when the number of iterations is not known beforehand.
Syntax:
while (condition) {
// Code to be executed as long as the condition is true
}
<!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
let i = 0; while (i < 10) { console.log(i); i++; }To download raw file Click Here
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions