Sobes.tech
Junior — Senior

Determining the order of output to the console (example 65)

livecode

Task condition

In what order will the messages be displayed in the console?

console.log(1);

setTimeout(function() {
    console.log(2);
});

Promise.resolve(3).then(console.log);

console.log(4);

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

console.log(6);

const repeatLog = () => {
    console.log('foo2');
    setTimeout(repeatLog);
}

repeatLog();