Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumNodeJSperf_hooks timingSingle-choice MCQ

What will this snippet print for the order and approximate value of the logged durations?

const { performance, PerformanceObserver } = require('perf_hooks'); const obs = new PerformanceObserver((list) => { for (const e of list.getEntries()) console.log(e.name, e.duration); }); obs.observe({ entryTypes: ['measure'] }); performance.mark('a'); setTimeout(() => { performance.mark('b'); setTimeout(() => { performance.mark('c'); performance.measure('a-to-b', 'a', 'b'); performance.measure('whole', 'a', 'c'); }, 30); }, 20);