Question from the Javascript test

Write a JavaScript function that returns a promise that resolves after 1 second with the string 'Hello'.

Easy

What will be the output of the following JavaScript code?

function asyncFunc() {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve('Hello');
    }, 1000);
  });
}

asyncFunc().then((value) => {
  console.log(value);
});
Author: Vincent CotroStatus: PublishedQuestion passed 112 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!