How would you expect == to behave differently from === ?
Although you might not think it, the amount of equal signs is very important.
Using just one = will assign a value, (which admittedly, is something I’ve done unintentionally once or twice), while == and === are both used to compare values, but they have different rules.
== is known as the "loose equality" operator, because it will try to convert the values being compared to a common type before making the comparison.
On the other hand, === is known as the "strict equality" operator, because it does not allow for type coercion, and requires that the types of the values being compared match exactly.
#اكسبلور #programming #learn #
コメント