I have written basic code in lwc js and it's not working any help would be appreciated.
here's my code -
////main js.
var worker = new Worker("/resource/webWorker");
worker.onmessage = function(e) {
alert('Message received from worker: ' + e.data);
};
worker.postMessage([2, 3]);
//// webWorker js.
onmessage = function(e) {
console.log('Message received from main script');
var workerResult = 'Result: ' + (e.data[0] * e.data[1]);
console.log('Posting message back to main script');
postMessage(workerResult);
}