substring and the problem with
parseInt() so here are some other interesting discoveries.
Since the '+' operator exists for strings anything added to a string will be coerced into being a string, numbers included:
The '-' operator, however, doesn't exist for strings so they will be coerced into being numbers, given the opportunity:
When comparing two types (in an
But sometimes, things don't behave as you would expect:
And then there are cases where types that shouldn't match do: