=== or = ? What is the difference?

Here is the code:

if (region === 'The Arctic'){
let lightWaves = 'Northern Lights';

My question: Why is === being used in the first line but only = is being used in the second line? Why would they both not be === ?

Both region and lightWaves are variables showing a value of a string.

=== is the operator we use for making strict comparisons.

= is the operator we use for making assignments.

5 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.