Advanced
Do the sum in a worker
The page adds the numbers 1 to 3,000,000 on the main thread, which freezes it for a moment.
Move the loop into a Web Worker built from text, and show Total: 4500001500000 when the worker answers.
What Check tests
- The page shows the total
- The loop runs in a worker
- The page code has no summing loop of its own
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.