Skip to content
Onsite

Output: logging the result of calling an async function that returns 1

EasyP2Output

What does this code print?

1async function one() {
2 return 1;
3}
4const result = one();
5console.log(result === 1);
6console.log(result instanceof Promise);
7console.log(Object.prototype.toString.call(result));
8result.then((v) => console.log('then', v));
9console.log('end');
Saved automatically

One line per console.log. Arrays as [1, 2, 3], objects as { a: 1 }, an uncaught error as Uncaught TypeError: message (Chrome and Node wording).

Hints

Saved automatically