Question 71
Refer to the code below:
let productSKU = '8675309';
A developer has a requirement to generate SKU numbers that are always 19 characters long, starting with 'sku', and padded with zeros.
Which statement assigns the value sku000000008675309?
Question 72
Refer to the code below:
01 const server = require('server');
02
03 // Insert code here
A developer imports a library that creates a web server. The imported library uses events and callbacks to start the server.
Which code should be inserted at line 03 to set up an event and start the web server?
Question 73
Refer to the code:
01 let car1 = new Promise((_, reject) =>
02 setTimeout(reject, 2000, "Car 1 crashed in"));
03 let car2 = new Promise(resolve =>
04 setTimeout(resolve, 1500, "Car 2 completed"));
05 let car3 = new Promise(resolve =>
06 setTimeout(resolve, 3000, "Car 3 completed"));
07
08 Promise.race([car1, car2, car3])
09 .then(value => {
10 let result = '$(value) the race.';
11 })
12 .catch(err => {
13 console.log("Race is cancelled.", err);
14 });
What is the value of result when Promise.race executes?
Question 74
A developer needs to debug a Node.js web server because a runtime error keeps occurring at one of the endpoints.
The developer wants to test the endpoint on a local machine and make the request against a local server to look at the behavior. In the source code, the server.js file will start the server. The developer wants to debug the Node.js server only using the terminal.
Which command can the developer use to open the CLI debugger in their current terminal window?
(With corrected typing errors: node_inspect → node inspect, node_start_inspect → node start inspect.)
Question 75
Given the JavaScript below:
Which code should replace the placeholder comment on line 05 to highlight accounts that match the search string'
