Identity in Javascript
"Proof by analogy is fraud." ~ Bjarne Stroustrup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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'. |