Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumNodeJSWorker threads basicsSingle-choice MCQ

A Worker is created with a large object passed via the second argument's `workerData`. The main thread mutates the original object right after the Worker is constructed. What does the Worker observe?

const { Worker, isMainThread, workerData } = require('worker_threads'); if (isMainThread) { const data = { count: 1 }; const w = new Worker(__filename, { workerData: data }); data.count = 999; // mutate after construction } else { console.log(workerData.count); }