Skip to content

Instantly share code, notes, and snippets.

@shaunwallace
Created November 19, 2014 12:28
Show Gist options
  • Save shaunwallace/909f92960f605998b944 to your computer and use it in GitHub Desktop.
Save shaunwallace/909f92960f605998b944 to your computer and use it in GitHub Desktop.
Object.getPrototypeOf()
// Object.getPrototypeOf(obj);
var obj = Object.create({}); // creates an empty object and is equivalent to obj = {} or obj = Object.create(Object.prototype)
var obj1 = {
foo : 1,
bar : function() {
return 'Bar method called';
}
};
var obj3 = Object.create(obj1, {
baz : {
value : 'Hello World'
}
});
Object.getPrototypeOf( obj3 ) === obj1; // returns true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment