Created
November 19, 2014 12:28
-
-
Save shaunwallace/909f92960f605998b944 to your computer and use it in GitHub Desktop.
Object.getPrototypeOf()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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