Skip to content

Instantly share code, notes, and snippets.

@voltrevo
Last active April 10, 2023 01:17
Show Gist options
  • Save voltrevo/29c34217312f0837158677413315b82a to your computer and use it in GitHub Desktop.
Save voltrevo/29c34217312f0837158677413315b82a to your computer and use it in GitHub Desktop.
function main() {
const x = getAThing();
const valueBefore = x.value;
someOtherFunction();
const valueAfter = x.value;
console.log(
valueBefore === valueAfter // false
);
}
const thing = {
value: 3,
};
function getAThing() {
return thing;
}
function someOtherFunction() {
thing.value++;
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment