How to know that two javascript variable point to the same memory address

javascript

Solution

You can't alias variables like you can in C. In javascript, something like

var x = 1;
var y = x
y = 4;
// x is still 1

will always be the case.

However, objects are always passed by reference

var x = { one: 1, two: 2 };
var y = x;
y.one = 100;
// x.one is now 100

Problem

Is there a way to know that 2 javascript variable point to the same memory address ? ``` var my_var = { id: 1, attribute: "myAttribute" } var copy = my_var; //someting like if(copy === my_var) return true; ```

Original source