Code Lab

Timer: 3 min, like in an interview. Hints and autocomplete are off while it runs

Output order

EasyAsync code3 min

What does this code print? Write one line for each console log call.

console.log('sync 1');
setTimeout(() => {
  console.log('timeout');
}, 0);
Promise.resolve().then(() => {
  console.log('then');
});
console.log('sync 2');

Source

Your answer
Loading the editor...
Press Run to see the test results here