In JavaScript there are two operator you can use to compare values == and ===.
Let's understand few examples of == to understand how it works.
Algorithm of ==
- If one of the operands is Object and other is not return false
- If both operands are Object if reference is not same, return false
- If One of the operands is NaN returns false
- Check if Operands can be converted to Same primitive types and then compare.
Top comments (0)