1//AND Operator expressed as &&
2
3const x = 7;
4const y = 4;
5
6(x == 7 && y == 5); // false
7(x == 3 && y == 4); // false
8(x == 7 && y == 4); // true
9
10if (condition == value && condition == otherValue) {
11 return something;
12}
1//The OR operator in Javascript is 2 verticals lines: ||
2
3var a = true;
4var b = false;
5
6if(a || b) {
7 //one of them is true, code inside this block will be executed
8}
1var a = 2;
2var b = 5;
3var c = 10;
4
5if (a === 3 || a === 2) {
6 console.log("TRUE");
7} else {console.log("FALSE");}
8if (a === 4 || b === 3 || c === 11) {
9 console.log("TRUE");
10} else {console.log("FALSE");}
11if (b === 5 || c != 10) {
12 console.log("TRUE");
13} else {console.log("FALSE");}
14
15/* Output:
16TRUE
17FALSE
18TRUE
19*/