"2" < 0 # -> false
This should be a strange event if you are new to programming in general or coming from some other programming paradigm which has static typing like C or Java. The case is more interesting when you consider this particular example:
"2" == 2 # -> true
"2" === 2 # -> false
Popular explanation I have heard on this is
=== operator compares the data type along with the values. Thus, returning
false upon it’s deployment. Which makes sense.
"2" in first example to
2 of integer type and compare it to 2 in the right side of
Whereas in the second example it just SKIPS THE COERCION. This is important to understand that the engine is simply skipping the coercion step, not comparing the data type.
So, the result is the same but the reason is different!
Hope you felt enlightened as I felt when I found this out!! Cheers!