This question seems a bit silly but I just wanna confirm my understanding.
I'm learning about comparision in JavaScript and it seems to me that if two ojbects have the same address then they should definitely be equal (b/c basically they are one?). Is this always true?
bonus question: in the case I do want to implement this address comparision (shallow comparision), can I do it in pure JS without Object.is or ===?
Two objects cannot occupy the same location, either in our physical universe or in the twisted javascript universe. What you can have are two objects whose values are references to the same memory location.
var x = [1, 2, 3]
var y = x
So, the array [1, 2, 3] might be stored in some memory address, let's say it starts at 00A4. The variable x will be stored in some different place in memory, let's say 0108, and the actual value stored in that location is the number 00A4, that represents the memory location of its referenced value. Now, y will be then store in another totally different memory location, let's say 020F, and its value will also be 00A4, the memory location of its referenced value.
Both x and y are variables whose values are references, that ultimately point to the same address. Reference values that point to the same address are always equal when compared.
Javascript doesn't have any low-level semantics like this to manipulate memory addresses. You could do that maybe by using c procedure calls or something.