wencaizhang

Equality

# JavaScript Fundamental
Easy
When we write programs, it's common to check if variables are equal to other variables. This is where the equality operator comes into play. The most basic equality operator is
. It goes to great lengths to establish if two variables are equal, even if they aren't the same type.
For instance, consider the following:
Behind the scenes, the
equality operator attempts to make its operands the same type before determining their equality. This is different from the
equality operator.
The
equality operator insists that two variables are only equal if they are of the same type and hold the same value. Given our earlier assumptions, this means
still evaluates to
. However,
will now evaluate to
. Similarly, baz
qux will still evaluate to
.
JavaScript Playground
JavaScript
Loading...
Console