Skip to content

Instantly share code, notes, and snippets.

@jmaicaaan
Last active September 30, 2021 14:43
Show Gist options
  • Save jmaicaaan/36f5e68c25759f49c32a633ad78853d5 to your computer and use it in GitHub Desktop.
Save jmaicaaan/36f5e68c25759f49c32a633ad78853d5 to your computer and use it in GitHub Desktop.
const person01 = {
name: 'JM'
};
const person02 = person01;
/**
* Mutating `person02` will cause effect also on `person01` because
* `person01` was assigned by reference not by value
*/
person02.name = 'JM Santos';
console.log('person01', person01); // JM Santos
console.log('person02', person02); // JM Santos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment