0
Q:

if statements javascript

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
let a = 1;
let b = 2;
if(a == 1 && b ==2){
	// Code here 
}
0
/* Shorten if-else by ternary operator*/
const go = "yes"
let race = null

race = go === "yes" ? 'Green Light' : 'Red Light';
0
if (pros < 10) {
  console.log("LESS THAN 10 PROS!");
}
else if (pros < 5) {
  console.log("LESS THAN 5 PROS!");
}
else {
  console.log("How many pros are there?");
}
0
if (A === B) && B === 1) {
  // Code here
}
0
if x > y 
  alert("Hello World");

-1

New to Communities?

Join the community