javascript 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: or in js
var firstnumber = 10;
var secondnumber = 20;
if(firstnumber > 20 || secondnumber< 10) {
}
Example 3: not operator js
let a = true;
let b = !a;
console.log(b);
Example 4: javascript and operator
const x = 7;
const y = 4;
(x == 7 && y == 5);
(x == 3 && y == 4);
(x == 7 && y == 4);
if (condition == value && condition == otherValue) {
return something;
}
Example 5: js logical operators
Javascript Logical Operators
&& Logical and
|| Logical or
! Logical not
Example 6: or operator in javascript
var a = true;
var b = false;
if(a || b) {
}