javascript and if code example
Example 1: js if else
If - Else Statements
if (condition) {
// what to do if condition is met
} else {
// what to do if condition is not met
}
Example 2: javascript if and statement
let a = 1;
let b = 2;
if(a == 1 && b ==2){
// Code here
}
Example 3: javascript if or
let A = 1;
let B = 0;
if (A == 1 || B == 1){
// some code here
}
Example 4: javascript if
if (32 == 32) {
console.log('32 is equil to 32!');
}
Example 5: if javascript
if (a > 0) {
result = 'positive';
} else {
result = 'NOT positive';
}