While Loop BasicsThe while loop syntax. While Loop Basics The while loop loops through a block of code as long as a specified condition is true. while (condition) { // code block to be executed } Examplelet i = 0; while (i < 10) { console.log(i); i++; }Try it Yourself PreviousNext