Sobes.tech
Junior — Senior

Determining the output sequence in the console (example 15)

livecode

Task condition

Specify which values will appear in the console when executing the following JavaScript code fragment:

 console.log('0');

setTimeout(function timeout() {
    console.log('1');
}, 100);

let p = new Promise(function(resolve, reject) {
    console.log('2');
    resolve();
});

p.then(function() {
    console.log('3');
});

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

console.log('6');