A developer wants to advocate for a mature, well-supported web framework/library instead of a new one (Minimalist.js).
Which two should be recommended?
Universal Containers (UC) just launched a new landing page, but users complain that the website is slow. A developer found some functions that might cause this problem. To verify this, the developer decides to execute everything and log the time each of these three suspicious functions consumes.
01 console.time( ' Performance ' );
02
03 maybeAHeavyFunction();
04
05 thisCouldTakeTooLong();
06
07 orMaybeThisOne();
08
09 console.endTime( ' Performance ' );
Which function can the developer use to obtain the time spent by every one of the three functions?
After user acceptance testing, the developer is asked to change the webpage background based on the user’s location. It works on the developer’s computer but not on the tester’s machine.
Which two actions will help determine accurate results?
Original code:
01 let requestPromise = client.getRequest;
03 requestPromise().then((response) = > {
04 handleResponse(response);
05 });
The developer wants to gracefully handle errors from a Promise-based GET request.
Which code modification is correct?
What are two unique features of fat-arrow functions compared to normal function definitions?
Refer to the code:
01 function execute() {
02 return new Promise((resolve, reject) = > reject());
03 }
04 let promise = execute();
05
06 promise
07 .then(() = > console.log( ' Resolved1 ' ))
08 .then(() = > console.log( ' Resolved2 ' ))
09 .then(() = > console.log( ' Resolved3 ' ))
10 .catch(() = > console.log( ' Rejected ' ))
11 .then(() = > console.log( ' Resolved4 ' ));
What is the result when the Promise in the execute function is rejected?
Code:
01 const sayHello = (name) = > {
02 console.log( ' Hello ' , name);
03 };
04
05 const world = () = > {
06 return ' World ' ;
07 };
08
09 sayHello(world);
This does not print " Hello World " .
What change is needed?
A developer wants to use a try...catch statement to catch any error that countSheep() may throw and pass it to a handleError() function.
What is the correct implementation of the try...catch?