Comment

Comment by jallardice

You don't even have to resolve the promise via a callback for that to be the case - you can use the static resolve method. This is really useful if you have a function that can sometimes return a promise and sometimes a "normal" value.

    Promise.resolve("resolved!").then(result => console.log(result));
    console.log("next statement");
parent jallardice 11 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton