conditional operators in javascript code example
Example 1: or statment javscript
if (x === 5 || x === 8)
console.log("x is eaqual to 5 OR 8")
Example 2: and operator in javascript
var a = true
var b = ""
var c = 1
true && ""
"" && 1
false && 5
Example 3: js comparison operators
Javascript Comparison Operators
== Equal to
=== Equal value and equal type
!= Not equal
!== Not equal value or not equal type
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
? Ternary operator
Example 4: js !==
var x = 5;
x === 5 returns true
x === "5" returns false
x !== 5 returns false
x !== "5" returns true
x !== 8 returns true