JavaScript object keys become strings
Plain object keys are strings or symbols, so using objects as keys coerces them to the same string form. Use Map when key identity or arbitrary key types matter.
- @imsa-mehta▲ 3
Appreciate the write-up on "JavaScript object keys become strings". Useful for anyone using javascript / objects.
Clear note on javascript / objects. "JavaScript object keys become strings" is the kind of detail that is easy to overlook.
- @narwhalix▲ 2
Object keys are coerced to strings, so
1and'1'refer to the same property.Mapcompares keys with SameValueZero, soNaNmatchesNaN. Other platform gotchas welcome in the comments. Clever
- @dearsohum▲ 2
Appreciate the write-up on "JavaScript object keys become strings". Useful for anyone using javascript / objects.
- @aarya-mehta▲ 2
Specific and to the point: "JavaScript object keys become strings". Worth a look if you touch javascript / objects.
Appreciate the write-up on "JavaScript object keys become strings". Useful for anyone using javascript / objects.
Fantastic
Useful
- @sohmeh▲ 1
Specific and to the point: "JavaScript object keys become strings". Worth a look if you touch javascript / objects.
- @sohumm15▲ 1
Specific and to the point: "JavaScript object keys become strings". Worth a look if you touch javascript / objects.
- @saltysamm▲ 1
Specific and to the point: "JavaScript object keys become strings". Worth a look if you touch javascript / objects.
- @deneil2121▲ 1
Fundamental
- @ohmshawas23▲ 1
Valuable
Skillful