Problems

Sequential vs Parallel Order

MediumAsync & Promises

Given this program, print its exact console output (one token per line):

console.log('A');
Promise.resolve().then(() => console.log('C'));
console.log('B');
setTimeout(() => console.log('E'));
Promise.resolve().then(() => console.log('D'));

The input is the number of times to repeat that prediction, separated by a blank line between repeats.

Input: one integer k. Output: the 5-line sequence, repeated k times, with a blank line between repeats.

Your program reads from stdin and prints to stdout.

Example 1

Input: 1

Output: A B C D E

Hints

JavaScriptAsyncEvent Loop