DEV Community

loading...

Discussion on: Coercion in JavaScript.

Collapse
thesoreon profile image
Paul Susicky • Edited

Cool post, Uddesh!

I have a note on this paragraph.

console.log('100' === 100) // False

In the case of triple equal, the result will be False because triple equal operator strictly checks the type of left and right side.

In fact, we can say that triple equal checks value with coercion "disabled". On the other hand double equal allows coercion.

Collapse
uddeshjain profile image
Uddesh Author

Yes, This also can be a case but as far as I concerned triple equal checks the type of the value of left and right side.

Collapse
azarouamine profile image
AzarouAmine • Edited

The triple equal checks both the value and the type, so in this example's case, the values are equal but the types aren't, so the output is false (false(type) & true(value) => 0 & 1 == 0 => false).