diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 86374d8fcc3c81..a9fd6053d9defc 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -1265,7 +1265,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'); @@ -1282,7 +1284,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');