How web worker works with a practical example

Ever noticed a webpage freezing during a heavy task? This happens because JavaScript runs on a single thread by default, causing a bad user experience. Users can't interact and have to wait until the task finishes. This problem can be solved using we...