Complete the code to schedule a function to run after the current event loop phase.
setTimeout(() => { console.log('Hello'); }, [1]);Using 0 as the delay schedules the function to run after the current event loop phase.
Complete the code to add a callback to the next tick queue.
process.[1](() => { console.log('Next tick'); });
process.nextTick schedules a callback to run immediately after the current operation, before other event loop phases.
Fix the error in the code to correctly schedule a callback after the current timers phase.
setImmediate(() => { console.log('Immediate'); });
setTimeout(() => { console.log('Timeout'); }, [1]);Using 0 as the delay in setTimeout schedules the callback after the current timers phase, matching expected behavior.
Fill both blanks to create a map of timers with delays and their callback names.
const timers = { [1]: 'first', [2]: 'second' };The keys are timer delays in milliseconds, so 100 and 200 are correct.
Fill all three blanks to create a filtered object of callbacks with delays greater than 100.
const filtered = Object.entries(timers).reduce((acc, [[1], [2]]) => { if ([1] [3] 100) { acc[[1]] = [2]; } return acc; }, {});
The reduce uses delay as key, cb as value, and filters delays greater than 100.