Whats the different between two (`==`) and three (`===`) equal signs?

Why are there three === instead of two?

3 equals signs is known as Identity / strict equality, meaning that the data types also must be equal:

console.log(1 == true) // output: true
console.log(1 === true) // output: false

For anyone still interested - there is a great explanation with examples here


what about a single (=) equals? In this module 7 (number) does seem to = 7 (number) and also “7” (string). I understand why you would use triple equals, but why NOT use single as opposed to double?

= is assignment.
== check if values are equal:

3 == "3" // true

=== also check if the data type matches:

3 === "3" // false

Okay, I see. I wasn’t actually comparing 7 (number) to 7(number) it was redefining the variable, and in this case they did just so happen to actually be equal. When I reran the premise just now I found that the following IF evaluated as true (or perhaps more technically, the variable sven had a truthy value?).

let sven = 7;
if (sven='taco') {

The output to the console was ‘taco’.

So now this is clear to me. Thanks for the feedback!

Thanks for sharing this article!

The “===” stands for “equal to” whiles the “==” stands for equivalence.

No caso desse exemplo => ‘apples’ === ‘oranges’ // false qual foi o criterio para resultado ser falso?como se chegou a esse resultado ok ambos sao strings e ‘apples’ != ‘orange’

thank you!!! <3 <3 <3

thank you so much!!!

Thank you! This answer is very clear!