js-l12 code example

Example: js.l12

//  if (condition) {
	console.log();
 } else {
 	console.log();
 }
 
 
 EXAMPLE:
 ---------
//
const Age = 16;
if (Age >= 20) {
   console.log(`you are a man.`);  
} else {
   console.log(`you are young.`);
}



//
 const age = 18;

if (age >= 18) {
   console.log(`you are perfect for driving`);
} else {
   const Yearleft = 18-age ;
   console.log(`you are don't ready for driving.\nTry it after ${Yearleft} year left:>.`)
}




//
 const max = 1995;
let centuri;
if (max <= 2020) {
    centuri = `2nd centuri`;
} else {
    centuri = `3rd centuri`;
}
console.log(`This year is ${centuri}!`);

Tags:

Misc Example