← BYTES
JavaScript·Starter·Ref: 3.1.2
What is the key difference between `==` and `===` in JavaScript?
Have a question about this video? Mention reference 3.1.2 when you contact us.
a.`==` performs type coercion before comparing; `===` compares both value and type with no coercion
b.They are functionally identical
c.`===` is only used for strings
d.`==` is deprecated and should never be used
`==` (loose equality) coerces operands to a common type before comparing (e.g., 1 == "1" is true); `===` (strict equality) requires both value and type to match with no coercion (1 === "1" is false) -- defaulting to `===` avoids a large class of coercion-related bugs.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES312#JavaScript