Skip to content

Instantly share code, notes, and snippets.

@wuliupo
Created November 11, 2016 09:09
Show Gist options
  • Select an option

  • Save wuliupo/211f09572fdc1924a92339e722203108 to your computer and use it in GitHub Desktop.

Select an option

Save wuliupo/211f09572fdc1924a92339e722203108 to your computer and use it in GitHub Desktop.
property extended from parent
var parentObj = {a:2};
var sunObj = Object.create( parentObj );
parentObj.a; // 2
sunObj.a; // 2
parentObj.hasOwnProperty( "a" ); // true
sunObj.hasOwnProperty( "a" ); // false
sunObj.a++; // block mode
parentObj.a; // 2
sunObj.a; // 3
sunObj.hasOwnProperty("a"); // true ???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment