Skip to content

Comparing values

Read · 1 of 3

Use === and !==

<, >, <=, >= work as in maths. === means is equal to and !== is not equal to.

JavaScript also has ==, which converts types first, so "5" == 5 is true. That causes bugs: always use the three-character versions.