Which two results occur when running this test on the updated sum3 function?

A developer wrote the following code to test a sum3 function that takes in an array of numbers and returns the sum of the first three numbers in the array, and the test passes. A different developer made changes to the behavior of sum3 to instead sum only the first...

March 1, 2022 1 Comment READ MORE +

What is returned by the function call on line 13?

Refer to the following code: function test (val) { If (val === undefined) { return ‘Undefined values!’ ; } if (val === null) { return ‘Null value! ’; } return val; } Let x; test(x); What is returned by the function call on line 13?A . UndefinedB . Line 13...

March 1, 2022 No Comments READ MORE +

Which command can the web developer run to see what the module is doing during the latency period?

developer has a web server running with Node.js. The command to start the web server is node server,js. The web server started having latency issues. Instead of a one second turn around for web requests, the developer now sees a five second turnaround, Which command can the web developer run...

March 1, 2022 No Comments READ MORE +

What can the developer do to change the code to print “Hello World”?

The developer has a function that prints “Hello” to an input name. To test this, the developer created a function that returns “World”. However the following snippet does not print “Hello World”. What can the developer do to change the code to print “Hello World”?A . Change line 7 to...

March 1, 2022 No Comments READ MORE +

.finally(() => console.log(" when am I called?

Refer to the code below: new Promise((resolve, reject) => { const fraction = Math.random(); if( fraction >0.5) reject("fraction > 0.5, " + fraction); resolve(fraction); }) .then(() =>console.log("resolved")) .catch((error) => console.error(error)) .finally(() => console.log(" when am I called?")); When does Promise.finally on line 08 get called?A . When rejectedB . When...

February 28, 2022 No Comments READ MORE +

What kind of export be leverages so that multiple functions can be used?

A developer has an ErrorHandler module that contains multiple functions. What kind of export be leverages so that multiple functions can be used?A . NamedB . AllC . MultiD . DefaultView AnswerAnswer: A

February 28, 2022 No Comments READ MORE +

Which code change should be made for the console to log only Row log when ‘Click me! ’ is clicked?

Refer to the code below: <html lang=”en”> <table onclick=”console.log(Table log’);”> <tr id=”row1”> <td>Click me!</td> </tr> <table> <script> function printMessage(event) { console.log(‘Row log’); } Let elem = document.getElementById(‘row1’); elem.addEventListener(‘click’, printMessage, false); </script> </html> Which code change should be made for the console to log only Row log when ‘Click me! ’...

February 28, 2022 No Comments READ MORE +

Which JavaScript statement changes the text ‘In Progress’ to ‘Completed’?

Refer to HTML below: <p> The current status of an Order: <span id =”status”> In Progress </span> </p>. Which JavaScript statement changes the text ‘In Progress’ to ‘Completed’?A . document.getElementById(“status”).Value = ’Completed’ ;B . document.getElementById(“#status”).innerHTML = ’Completed’ ;C . document.getElementById(“status”).innerHTML = ’Completed’ ;D . document.getElementById(“.status”).innerHTML = ’Completed’ ;View AnswerAnswer: C

February 27, 2022 No Comments READ MORE +

Which two tests are the most accurate for this array?

The developer wants to test the array shown: const arr = Array(5).fill(0) Which two tests are the most accurate for this array? Choose 2 answers:A . console.assert( arr.length === 5 );B . arr.forEach(elem => console.assert(elem === 0)) ;C . console.assert(arr[0] === 0 && arr[ arr.length] === 0);D . console.assert (arr.length...

February 27, 2022 No Comments READ MORE +

What are the values of greeting and salutation once code completes?

Refer to the code below: Line 05 causes an error. What are the values of greeting and salutation once code completes?A . Greeting is Hello and salutation is Hello, Hello.B . Greeting is Goodbye and salutation is Hello, Hello.C . Greeting is Goodbye and salutation is I say Hello.D ....

February 27, 2022 No Comments READ MORE +