Where should you place the web worker code?

You are developing an HTML5 page named main.html. The JavaScript code for the main
page is located in a file named myApp.js.
You need to create a web worker and instantiate it from main.html.
Where should you place the web worker code?

You are developing an HTML5 page named main.html. The JavaScript code for the main
page is located in a file named myApp.js.
You need to create a web worker and instantiate it from main.html.
Where should you place the web worker code?

A.
In the myApp.js file

B.
In the main.html file

C.
In a separate .js (JavaScript) file

D.
In a separate executable file



Leave a Reply 2

Your email address will not be published. Required fields are marked *


hajjaj jamal alhajjai

hajjaj jamal alhajjai

In the main.html file

anii

anii

No, C is correct.

https://www.w3schools.com/html/html5_webworkers.asp

“A web worker is a JavaScript that runs in the background, independently of other scripts, without affecting the performance of the page.”
“let’s create our web worker in an external JavaScript”