Last active
September 28, 2016 02:28
-
-
Save dengjonathan/1cf42e19efc7ff3e52693cc5b8773a75 to your computer and use it in GitHub Desktop.
OOP style
This file contains 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
const hasLegsMaker = num => ({ legs: num }); | |
const noiseMaker = noise => { | |
return { makeNoise: () => { console.log(`All day I just ${noise}`) } }; | |
}; | |
var fido = Object.assign({}, hasLegsMaker(4), noiseMaker('woof!')); | |
fido.makeNoise(); //All day I just woof! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment