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

A 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 turnaround for web requests, the developer now sees a five second turnaround. Which command can the web developer run...

February 24, 2022 No Comments READ MORE +

What is the correct syntax to schedule this function?

A developer has a formatName function that takes two arguments, firstName and lastName and returns a string. They want to schedule the function to run once after five seconds. What is the correct syntax to schedule this function?A . setTimeout (formatName(), 5000, "John", "BDoe");B . setTimeout (formatName('John', ‘'Doe'), 5000);C ....

February 24, 2022 No Comments READ MORE +

Which two assert statements are valid tests for the function?

A developer needs to test this function: 01 const sum3 = (arr) => ( 02 if (!arr.length) return 0, 03 if (arr.length === 1) return arr[0], 04 if (arr.length === 2) return arr[0] + arr[1], 05 return arr[0] + arr[1] + arr[2], 06 ); Which two assert statements are valid...

February 24, 2022 1 Comment READ MORE +

Which two options can correctly replace line 01 and declare the function for use?

A developer wants to define a function log to be used a few times on a single-file JavaScript script. 01 // Line 1 replacement 02 console.log('"LOG:', logInput); 03 } Which two options can correctly replace line 01 and declare the function for use? Choose 2 answersA . function leg(logInput) {B...

February 24, 2022 No Comments READ MORE +

Which code assignment shows a correct way to convert this string to an integer?

Refer to the code below: Let textValue = ’1984’; Which code assignment shows a correct way to convert this string to an integer?A . let numberValue = Number(textValue);B . Let numberValue = (Number)textValue;C . Let numberValue = textValue.toInteger();D . Let numberValue = Integer(textValue);View AnswerAnswer: A

February 24, 2022 No Comments READ MORE +

What are two valid ways to return the logical AND of the two expressions and ensure it is data type Boolean?

Given two expressions var1 and var2 . What are two valid ways to return the logical AND of the two expressions and ensure it is data type Boolean? Choose 2 answers:A . Boolean(var1 && var2)B . var1 && var2C . var1.toBoolean() && var2toBoolean()D . Boolean(var1) && Boolean(var2)View AnswerAnswer: A,D

February 23, 2022 No Comments READ MORE +

Which two statements correctly execute the runParallel () function?

Refer to the code below: 01 const exec = (item, delay) =>{ 02 new Promise(resolve => setTimeout( () => resolve(item), delay)), 03 async function runParallel() { 04 Const (result1, result2, result3) = await Promise.all{ 05 [exec (‘x’, ‘100’) , exec(‘y’, 500), exec(‘z’, ‘100’)] 06 ); 07 return `parallel is done:...

February 23, 2022 No Comments READ MORE +

What is logged to the console?

Given the code below: const delay = sync delay => { Return new Promise((resolve, reject) => { setTimeout (resolve, delay);});}; const callDelay =async () =>{ const yup =await delay(1000); console.log(1); What is logged to the console?A . 1 2 3B . 1 3 2C . 2 1 3D . 2...

February 23, 2022 No Comments READ MORE +

Which two options remove the whitespace from the beginning of searchString?

Refer to the code below? Let searchString = ‘ look for this ’; Which two options remove the whitespace from the beginning of searchString? Choose 2 answersA . searchString.trimEnd();B . searchString.trimStart();C . trimStart(searchString);D . searchString.replace(/*ss*/, ‘’);View AnswerAnswer: B,D

February 23, 2022 No Comments READ MORE +

What is the output after the code executes successfully?

Refer to the code below: console.log(‘’start); Promise.resolve(‘Success’) .then(function(value){ console.log(‘Success’); }); console.log(‘End’); What is the output after the code executes successfully?A . End Start SuccessB . Start Success EndC . Start End SuccessD . Success Start EndView AnswerAnswer: C

February 22, 2022 No Comments READ MORE +