1o1 = true || true // t || t returns true
2o2 = false || true // f || t returns true
3o3 = true || false // t || f returns true
4o4 = false || (3 == 4) // f || f returns false
5o5 = 'Cat' || 'Dog' // t || t returns "Cat"
6o6 = false || 'Cat' // f || t returns "Cat"
7o7 = 'Cat' || false // t || f returns "Cat"
8o8 = '' || false // f || f returns false
9o9 = false || '' // f || f returns ""
10o10 = false || varObject // f || object returns varObject
11
1// The Or operator in Javascript is 2 vertical lines = ||
2
3//Example
4var firstnumber = 10;
5var secondnumber = 20;
6
7//The Or operator in action
8if(firstnumber > 20 || secondnumber< 10) {
9}
1>= // greater than or equal
2<= // less than or equal
3> // greater than
4< // less than
5== // equals
6=== // strictly equals
7!= // not equals
8!== // stricly not equals
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}