js comparison operators code example

Example 1: or operator in javascript

//The OR operator in Javascript is 2 verticals lines: ||

var a = true;
var b = false;

if(a || b) {
	//one of them is true, code inside this block will be executed
}

Example 2: equal to or more than javascript

//Equal to or more than
a >= b
//Equal to or less than
a <= b

Example 3: js different

true != true // => false

Example 4: javascript not equal

0 !== "0"
0 !== 0

Example 5: 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

Tags:

Misc Example