Comparison of comparison operators '==' and '===' in JavaScript

==: Returns true if the operands on both sides are equal.

Does not distinguish whether it is a numeric type or a string type

===: Returns true when the operands on both sides are equal and of the same type.

 

=== is more rigorous than ==. If you can use === for comparison, you will definitely not use ==.

 Reference Documentation: Basic Mathematics in JavaScript - Numbers and Operators - Learning Web Development | MDN (mozilla.org)

Guess you like

Origin blog.csdn.net/weixin_45441470/article/details/123338465