Hacker News new | ask | show | jobs
by jallardice 3859 days ago
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");