Skip to content
Onsite

Output: console.log, setTimeout 0 and Promise.resolve().then in sequence

EasyP1Output

What does this code print?

1console.log('A');
2setTimeout(() => console.log('B'), 0);
3Promise.resolve().then(() => console.log('C'));
4console.log('D');
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