Using `console.log` inside of a Worker in Chrome prints the same message twice Using `console.log` inside of a Worker in Chrome prints the same message twice google-chrome google-chrome

Using `console.log` inside of a Worker in Chrome prints the same message twice


This seems to be a strange behavior in Chrome, and someone has posted the same issue hereConsole.log double logging from web workers.

However, placing console.log directly inside worker.js is not a good practice. A web worker runs in a separate thread and listens to the messages posted from main.js and take actions accordingly, thus any business logic should be placed inside the onmessage event handler. By doing this, you don't have to worry about code being executed twice.