Strict Equality (===)
In short: === never converts. Different types are always unequal.
Primitives of the same type compare by value. Objects — including arrays
and functions — are equal only if they are the very same object, not
merely equal-looking ones. Two number quirks round it out: NaN === NaN
is false, and 0 === -0 is true. Because it never surprises you with a
hidden conversion, === should be your everyday default.

Compare the same object to itself
When two names point at the exact same object, === is true. Build a
second, separate object with identical fields, and it is false:
current === selected is true — same object, same reference. A freshly
written { title: "Blue Hour" } is a different object with matching
contents, so it fails. The third line compares the title strings
instead of the objects, and strings are primitives, so === compares them
by value: true.
Compare a clicked song to the current one
This is why comparing two objects for "do they represent the same thing"
fails when you compare the objects directly, even with matching data —
exactly the trap the drawing walks through: clicked arrives freshly built
from server data, so it is never the same object as selected, no matter
how identical their fields are. Comparing an identifying field instead
fixes it, because that field is a primitive, and primitives compare by
value:
The first line is false — two separate objects. The second is true —
id is a number, and numbers compare by value.
The check
if (clicked === selected), where both came from different places in the code.
Quick practice
What is "5" === 5?
What is NaN === NaN?
What is 0 === -0?
What is [1] === [1]?
What is a === b after const a = { plays: 1 }; const b = a;?
🎯 Your turn
A listener clicks a song and clickedSong === currentSong is false, even
though both print { title: "Blue Hour", seconds: 214 }. Explain why and
how to fix the comparison.
Write your explanation and submit it — there's no code to run here, just your reasoning.
