So I have this famous function from the documentation.
function resolveAfter2Seconds(x) {
return new Promise(resolve => {
setTimeout(() => {
resolve(x);
}, 2000);
});
}
How should I rewrite it so when I type console.log(resolveAfter2Seconds(10)) I would get a result not Promise {Pending} in the console? The first bit is probably easy - putting async in front. But what next?