JavaScript Simple Conditional Execution.

Photo by Joshua Aragon on Unsplash
cosnt number = -4;
if(number > 0){ //Conditional execution
console.log(`Number ${number} is positive.`)
}else {
console.log(`Number ${number} is negative.`)
}
let number = 0;
while(number <= 4){ //Conditional execution
console.log(`Count: ${number}`);
number++;
}
//output
Count: 0;
Count: 1;
Count: 2;
Count: 3;
Count: 4;
let number = 0;
while(number <= 4){ //Conditional execution
console.log(`Count: ${number}`);
number++;
if(number === 3){
break;
}
}
//output
Count: 0;
Count: 1;
Count: 2;
Count: 3;

Passionate reading || Coding Addicted || FullStack Web Developer from Costa Rica

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store