Skip to content

Instantly share code, notes, and snippets.

@jaitjacob
Created June 6, 2023 07:50
Identity of an Object in JS
//Concept: Object Identity
//Analogy: Quantum Entanglement of two Objects
particle_a = {
state: 'equilibrium'
};
particle_b = particle_a; //both particles are entangled
//Imagine vast seperation between particle 'a' & 'b'. I'm talking lots of lines of statements.
particle_b.state = 'excited'; //Let's induce a change to particle 'b' now.
//Check if the change induced to 'b' occurs in 'a'.
console.log(particle_a.state); //output: excited, hence QEntanglement proved.
//Keeping the analogy aside.
//Object 'particle_a' & 'particle_b' grasp the same object which is why changing property of 'a' reflect in 'b'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment