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

A main thread creates a `SharedArrayBuffer`, passes it as `workerData`, and the worker writes into a typed-array view over it. After the worker posts back, what does the main thread observe?

// main const sab = new SharedArrayBuffer(4); const view = new Int32Array(sab); new Worker(__filename, { workerData: sab }); // worker: new Int32Array(workerData)[0] = 42; parentPort.postMessage('done')