JavaScript Do-While Loop


JavaScript Do While Loop

The do...while statements combo defines a code block to be executed once, and repeated as long as a condition is true.

The do...while is used when you want to run a code block at least one time.

//do while Syntex


// do{
  // statement

  // inc/dec

// }while(condition)



//Example

let num = 1;

do{
  console.log("Namaste India");

  num = num+1; // num++
}while(num<=10)

Comments

Popular posts from this blog

Javascript Array Concat and Join Method

JavaScript While Loop

JavaScript pop() Method