Created
November 9, 2016 15:37
-
-
Save a-double/314d224b895020312d0b10f23d20fad7 to your computer and use it in GitHub Desktop.
Objects linking to other objects
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
| var Wrapper = { | |
| create: function() { | |
| return Object.create( Wrapper ); | |
| }, | |
| stuff: function() { | |
| console.log( 'stuff' ); | |
| } | |
| }; | |
| var Extension = Object.create( Wrapper ); | |
| Extension.stuff = function() { | |
| console.log( 'other stuff' ); | |
| }; | |
| var item = Extension.create().stuff(); // 'other stuff' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment