Oh wow, does that mean this does a deep comparison of the object? Wondering if I might want to start using this to find objects in an array of objects (as opposed to finding it by a property comparison). 1. I think it would be easier in some cases, and 2. wondering if this assigns a hash behind the scenes and has a lower time complexity.
No, it's not a deep comparison, it's equivalent to === between values, just like indexOf() on arrays. And yes, internally within the VM, every object has a unique ID which is used for comparisons using strict equality, but it isn't available as an exposed value in JS.
Oh wow, does that mean this does a deep comparison of the object? Wondering if I might want to start using this to find objects in an array of objects (as opposed to finding it by a property comparison). 1. I think it would be easier in some cases, and 2. wondering if this assigns a hash behind the scenes and has a lower time complexity.
No, it's not a deep comparison, it's equivalent to
===
between values, just likeindexOf()
on arrays. And yes, internally within the VM, every object has a unique ID which is used for comparisons using strict equality, but it isn't available as an exposed value in JS.For an in-depth look at that, see dev.to/krofdrakula/searching-throu...