Reputation: 103
Is there a searchable, unique identifier (i.e., key, uid, etc... - pardon the likely butchering of proper terms) to differentiate between ob1 and ob2 in this example?
var makeObject = function() {
return {example: 'property'};
};
var ob1 = makeObject();
var ob2 = makeObject();
Now we know that:
ob1 === ob2; // false
Beyond this boolean distinction of inequality, are there lower level unique characters being temporarily assigned to ob1 and ob2? If so, can these unique characters be accessed through the console?
EDIT: How to determine equality for two JavaScript objects? really gets into the differentiation aspect of my question, so thank you for that. I feel that the other part of my question focused more on the machine level difference of ob1 compared to ob2 (practicality and/or user accessibility aside) and I believe "different places in memory" certainly answers that.
Upvotes: 10
Views: 8103
Reputation: 19802
are there lower level unique characters being temporarily assigned to ob1 and ob2
Short answer: no, nothing that you'd be able to access.
By the way, the reason obj1
and obj2
are not equal in your example is because they're actually pointing to different places in memory. That's the only comparison that's being done (this is different than, say, JavaScript string comparison, which does not compare memory locations, but the value of the string itself).
Upvotes: 7