Skip to content

Instantly share code, notes, and snippets.

@nilshartmann
Created November 23, 2017 15:01
Show Gist options
  • Save nilshartmann/d530785e6e9bce58b8ac97d2e63f9e33 to your computer and use it in GitHub Desktop.
Save nilshartmann/d530785e6e9bce58b8ac97d2e63f9e33 to your computer and use it in GitHub Desktop.
class Hello {
async greet() {
return new Promise(res => {
setTimeout(() => res("Hallo Welt"), 1000);
});
}
}
const hello = new Hello();
(async () => {
try {
const greet = await hello.greet();
console.log("Greet: " + greet);
} catch (e) {
console.error("could not start: ", e);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment