Day 028 - Comparison Operators
As well as 'Arithmetic Operators', there's 'Comparison Operators'.
As the name suggests, these are used to make comparisons.
Here's some examples:
'Equal' ==
'Not Equal' !=
'Strict Equal' ===
'Strict Not Equal' !==
'Greater Than' >
'Greater Than or Equal' >=
'Less Than' <
'Less Than or Equal' <=
This demo shows them in action.
Pay careful attention to the difference between using 'Strict'.
1 == '1' true
1 === '1' false
Here ==
using a number and a string will return true
whilst using ===
will return false.