Comparison Operators: Equal and Not Equal

In JavaScript, an operator is a special symbol that performs a specific operation on one or more values (or operands).

The equal operator, written as ===, is used to compare two values to see if they are the same. For example:

Loading Code . . .

On the other hand, the not equal operator, written as !==, is used to compare two values to see if they are not the same. For example:

Loading Code . . .

Basically, the ! means not and the == means equal. So !== means not equal.


On the other hand, the == and != operators also compare two values, but they are not as strict as === and !==.

They will try to convert the values to be the same type before comparing them. For example, 5 == "5" would be true because JavaScript will convert the string "5" to the number 5 before comparing. However, it's generally recommended to use === and !== to avoid unexpected behavior.

Loading Code . . .

In the code below we have two variables (a and b).

Fill in the spaces indicated with the operations of Equal and Not Equal.

Loading...
Loading...
Loading...
Loading...
Loading...

© 2024 - ®Mewters