Last active
August 29, 2015 14:10
-
-
Save kkoziarski/9d0e6b85272d12e57693 to your computer and use it in GitHub Desktop.
Object.create - The Good Parts
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
//The method creates a new object that uses an old object as its prototype. | |
if (typeof Object.create !== 'function') { | |
Object.create = function (o) { | |
var F = function () {}; | |
F.prototype = o; | |
return new F(); | |
}; | |
} | |
var another_stooge = Object.create(stooge); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment