Created
January 19, 2019 08:00
-
-
Save rxluz/a1753f30f2aba9e981dc956d4f9d9df5 to your computer and use it in GitHub Desktop.
JS Design Patterns: Factory Functions, see more at: https://medium.com/p/2adfe878e949
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
const greet = name => ({ | |
sayHello: () => `Hello ${name}!`, | |
sayGoodbye: () => `Goodbye ${name}!`, | |
}); | |
const run = () => { | |
const greetRicardo = greet("Ricardo"); | |
console.log(greetRicardo.sayHello()); | |
console.log(greetRicardo.sayGoodbye()); | |
}; | |
run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment