The while loop is used when you want to loop until a certain condition becomes false.

Syntax:

JavaScript
while (condition) {
  // Code to be executed
}

Example:

JavaScript
let i = 0;
while (i < 5) {
  console.log(i);
  i++;
}