and or operator code example
Example 1:
||o1 = true || true
o2 = false || true
o3 = true || false
o4 = false || (3 == 4)
o5 = 'Cat' || 'Dog'
o6 = false || 'Cat'
o7 = 'Cat' || false
o8 = '' || false
o9 = false || ''
o10 = false || varObject
Example 2: logical operators javascript
if (a || b) {
console.log("I will run if either a or b are true");
}
if (a && b) {
console.log("I will run, if and only if a and b are both true");
}
if (!a) {
console.log("I will only run if a is false");
}
if (a) {
console.log("I will only run if a is true");
}