Instantly share code, notes, and snippets.

Embed
What would you like to do?
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