JS-While Loop Udemy Jose Portila

 var x=0;


while (x < 5){

  console.log("x is currently:"+x);

    console.log("x is still less than 5, adding 1 to x");


    x=x+1


}


Program:To print even number from 1-100

var x=0;


while (x < 101){

  console.log("x is currently:"+x);

  if (x % 2==0 ) {

  console.log("Even number:"+x);


}else {

  console.log("Not even number:"+x)

}

    console.log("x is still less than 5, adding 1 to x");


    x=x+1


}


Comments

Popular posts from this blog

Top 5 Best Books For Python,Data Science & Machine Learning

How To Start A BLOG

Top 50 Most Innovative Companies in 2020

Why Should We learn C Programming?

Blogger Tutorial