Skip to content

Instantly share code, notes, and snippets.

@triacontane
Last active May 12, 2018 07:41
Show Gist options
  • Select an option

  • Save triacontane/1c9d1e332d912406f4d95b9af7405f42 to your computer and use it in GitHub Desktop.

Select an option

Save triacontane/1c9d1e332d912406f4d95b9af7405f42 to your computer and use it in GitHub Desktop.
Objectを返す関数を実行した場合のObjectの参照先について
const getObj = function () {
return {
aaa:1,
bbb:2,
ccc:3
};
};
const obj1 = getObj();
const obj2 = getObj();
obj1.aaa = 4;
console.log(obj2.aaa); // 1 or 4 ???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment