logical operators in javascript code example
Example 1: js logical operators
Javascript Logical Operators
&& Logical and
|| Logical or
! Logical not
Example 2: or operator in javascript
var a = true;
var b = false;
if(a || b) {
}
Example 3: less than or equal to javascript
if(a <= 5){
yourFunction();
}
Example 4: and operator in javascript
var a = true
var b = ""
var c = 1
true && ""
"" && 1
false && 5
Example 5: js !==
var x = 5;
x === 5 returns true
x === "5" returns false
x !== 5 returns false
x !== "5" returns true
x !== 8 returns true
Example 6: and operator in javascript
console.log(5 & 13);