3 ms·
Javascript Maps and Sets key off of the object's identity, not its contents.
by AgentME 9y ago
Javascript Maps and Sets key off of the object's identity, not its contents.
- kevin_thibedeau 9y agoThat's all great. It isn't a hash, which by definition requires a hashing function applied to transform input data.
- ninkendo 9y agoShouldn’t they just call the attribute “objectIdentity” then? The fact that it’s used to access a hash table in some use cases doesn’t make it a “hash code”. You’d just as well call it an “equality checking code”, or name it after any other use case you could think of for a unique identifier. Ruby calls its equivalent construct “object_id” and that makes so much more sense.