logo CodeStepByStep logo

setTimeoutOutput

Language/Type: JavaScript events timers setTimeout

In what order will the given messages print to the console? (You may assume that the event loop is able to execute within a reasonable amount of time.)

console.log('A');

setTimeout(function() {
    console.log('B');
}, 5000);

console.log('C');

setTimeout(function() {
    console.log('D');
}, 0);

console.log('E');
output
(order shuffled)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.