0

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?

retro
  • 51
  • 8

1 Answers1

0

dont you need

resolveAfter2Seconds(1).then(c=>console.log(c))