user.id === id
user.id == id
Such equality comparisons are a source of a lot of jokes. Very often, we stumble on statements that look illogical. For example, what if we compare an empty string with a boolean
console.log("" == false); // true
This comparison is
true because we use double equals or the so-called loose equality. The result is
true because both values are converted to a common type and then compared. The above, in reality, looks more like:
console.log(Boolean("") === false); // true
=== (strict equality).
So, use triple equals to make your code explicit. It will save you from some weird bugs.