You are troubleshooting an application.
Users report that the UI is slow to respond.
You need to improve UI responsiveness by moving application tasks to web workers.
Which two tasks can you move to achieve this goal? (Each correct answer presents a
complete solution. Choose two.)

A.
A function that loops through the Document Object Model to update the style of page
elements
B.
A long-running calculation that requires looping through an array
C.
A function that performs graphic-intensive animation
D.
A function that stores large amounts of data to local storage
Explanation:
Note:
* Despite the improvements in JavaScript engines, it is not uncommon for users to encounter
frozen user interfaces as the browser works through resource intensive tasks. This leads to
a horrible user experience. The purpose of Web Workers is to give developers a way of
instructing the browser to process large tasks in the background; therefore preventing the UI
from freezing up.
* The Web Workers specification defines an API for spawning background scripts in your
web application. Web Workers allow you to do things like fire up long-running scripts to
handle computationally intensive tasks, but without blocking the UI or other scripts to handle
user interactions
The C answer is wrong because Web worker has no access for DOM. Therefore, it’s imposible to perform graphic animation
0
0
B and D are right answers.
0
0
But you cannot access the localStorage from a web worker, so D is not a valid option.
0
0
Despite the improvements in JavaScript engines, it is not uncommon for users to encounter frozen user
interfaces as the browser works through resource intensive tasks. This leads to a horrible user experience. The
purpose of Web Workers is to give developers a way of instructing the browser to process large tasks in the
background; therefore preventing the UI from freezing up.
* The Web Workers specification defines an API for spawning background scripts in your web application. Web
Workers allow you to do things like fire up long-running scripts to handle computationally intensive tasks, but
without blocking the UI or other scripts to handle user interactions
0
0