Monday, May 28, 2018

A note on comparison operators in JavaScript

A note on comparison operators in JavaScript:
some people using == and != in their tests for equality and non-equality. These are valid operators in JavaScript, but they differ from ===/!==
The former versions test whether the values are the same but not whether the values' datatypes are the same. The latter, strict versions test the equality of both the values and their datatypes. The strict versions tend to result in fewer errors, so we recommend you use them.

No comments:

Post a Comment