diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index e2b165ce0e8b1f..362cad18023c7f 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -1255,7 +1255,9 @@ import { if (isMainThread) { new Worker(new URL(import.meta.url)); - for (let n = 0; n < 1e10; n++) {} + for (let n = 0; n < 1e10; n++) { + // Looping to simulate work. + } } else { // This output will be blocked by the for loop in the main thread. console.log('foo'); @@ -1272,7 +1274,9 @@ const { if (isMainThread) { new Worker(__filename); - for (let n = 0; n < 1e10; n++) {} + for (let n = 0; n < 1e10; n++) { + // Looping to simulate work. + } } else { // This output will be blocked by the for loop in the main thread. console.log('foo');