The while loop in Javascript

Web DevelopmentFront End TechnologyJavascript

The purpose of a while loop is to execute a statement or code block repeatedly as long as an expression is true. Once the expression becomes false, the loop terminates.

Example

For example −

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

Output

This will give the output −

Hello
Hello
Hello
Hello
Hello
raja
Published on 27-Jun-2018 09:40:30
Advertisements