Comparisons

Comparisons
πŸ‘¨β€πŸ’Ό Great work! You've seen the critical difference between loose and strict equality.
πŸ¦‰ The key takeaway: always use === and !== in your code. Loose equality (== and !=) can lead to confusing bugs because of its type coercion rules.
For example, these are all true with loose equality:
'' == false // true
0 == '' // true
null == undefined // true
With strict equality, different types are never equal, which is almost always what you want.
TypeScript actually helps hereβ€”if you try to compare incompatible types with ===, TypeScript will warn you that the comparison will always be false!

Please set the playground first

Loading "Comparisons"
Loading "Comparisons"
Login to get access to the exclusive discord channel.
Loading Discord Posts