Skip to content

Instantly share code, notes, and snippets.

@reflectiondm
Created May 9, 2017 16:07
Show Gist options
  • Save reflectiondm/45dbdfd445f5edde292649a28c8fd03c to your computer and use it in GitHub Desktop.
Save reflectiondm/45dbdfd445f5edde292649a28c8fd03c to your computer and use it in GitHub Desktop.
class Greeter {
constructor(greeting) {
this.greeting = greeting;
}
call(message) {
console.log(`${message}, ${this.greeting}`);
}
}
const greeter = new Greeter('Dude');
greeter.call('Hello');
const p = new Promise((res, rej) => rej('oh, man!')).catch(greeter.call);
const detatchCaller = greeter.call;
detatchCaller('omg');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment