Web workers and message passing
Which side should update the heading with the total?
Examples
Worked example
Input
A worker finishes counting words.
Expected output
The page’s main script.
Hints and solution
Hint 1
Write down the starting state and walk through one example by hand.
Reveal worked answer
The worker sends the count in a message. The page owns the DOM and can use the message to update it.