Skip to content

Instantly share code, notes, and snippets.

@tomoh1r
Created December 15, 2012 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomoh1r/4295258 to your computer and use it in GitHub Desktop.
Save tomoh1r/4295258 to your computer and use it in GitHub Desktop.
親の値を変えてあげれば、複数であったとしても、子の値に伝播するテスト
'use strict';
var Hoge = Object.create(null);
Hoge.x = 10;
var h = Object.create(Hoge);
var f = Object.create(Hoge);
console.log(h.x);
// => 10
console.log(f.x);
// => 10
Hoge.x = 20;
console.log(h.x);
// => 20
console.log(f.x);
// => 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment