how to use and in if condition in javascript code example

Example 1: using if statements in javascript

if (expression) {
   Statement(s) to be executed if expression is true
} else {
   Statement(s) to be executed if expression is false
}

Example 2: javascript if and statement

let a = 1;
let b = 2;
if(a == 1 && b ==2){
	// Code here 
}

Example 3: if condition javascript

if (condition){
// if true then execute this -}
 else{
 // if statment is not true then execut this -
 }

Example 4: if statements javascript

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?");
}

Tags:

Cpp Example