Created
October 24, 2017 19:46
-
-
Save agatablue/85ad85f5f3daf3c85c8d93d07ada0cef to your computer and use it in GitHub Desktop.
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 alien = { | |
sayHello () { | |
return `Hello, my name is ${ this.name }`; | |
} | |
}; | |
const createAlien = (name) => { | |
return Object.assign(Object.create(alien), { | |
name | |
}); | |
} | |
const clark = createAlien('Clark'); | |
clark.sayHello(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment