Skip to content

Instantly share code, notes, and snippets.

@rxluz
Last active January 19, 2019 07:57
Show Gist options
  • Save rxluz/a459d462d7b76c92aa26d87fb2f2bae4 to your computer and use it in GitHub Desktop.
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
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