Last active
January 19, 2019 07:57
-
-
Save rxluz/a459d462d7b76c92aa26d87fb2f2bae4 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
class greet { | |
constructor(name) { | |
this.name = name; | |
} | |
sayHello() { | |
return `Hello ${this.name}!`; | |
} | |
sayGoodbye() { | |
return `Goodby ${this.name}!`; | |
} | |
} | |
const run = () => { | |
const helloRicardo = new sayHelloToMe("Ricardo"); | |
console.log(helloRicardo.sayHello()); | |
console.log(helloRicardo.sayGoodbye()); | |
}; | |
run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment