0
Q:

javascript if elseif

var age=20;
if (age < 18) {
	console.log("underage");
} else {
	console.log("let em in!");
}
27

if (hour < 18) {

    greeting = "Good day";

 }
else {

    greeting = "Good evening";

 }
 
5
/* Shorten if-else by ternary operator*/
const go = "yes"
let race = null

race = go === "yes" ? 'Green Light' : 'Red Light';
0

if (condition) {

  //  block of code to be executed if the condition is true

 }

 
5

if (hour < 18) {

    greeting = "Good day";

 } 
4
if (condition) {

} else if (other_condition) {

} else {

}
0

New to Communities?

Join the community