0
Q:

using if statements in javascript

if (condition1) {
  //  block of code to be executed if condition1 is true
} else if (condition2) {
  //  block of code to be executed if the condition1 is false and condition2 is true
} else {
  //  block of code to be executed if the condition1 is false and condition2 is false
}
37
var age=20;
if (age < 18) {
	console.log("underage");
} else {
	console.log("let em in!");
}
27
let A = 1;
let B = 0;
if (A == 1 || B == 1){
  	// some code here
}
4
if (expression) {
   Statement(s) to be executed if expression is true
} else {
   Statement(s) to be executed if expression is false
}
0

New to Communities?

Join the community