Salesforce Certified JavaScript Developer I Practice Test - Questions Answers, Page 3

List of questions
Question 21

A developer is required to write a function that calculates the sum of elements in an array but is getting undefined every time the code is executed. The developer needs to find what is missing in the code below.
Const sumFunction = arr => {
Return arr.reduce((result, current) => {
//
Result += current;
//
), 10);
);Which option makes the code work as expected?
Question 22

Given code below: setTimeout (() => ( console.log(1);
Question 23

Which statement accurately describes the behaviour of the async/ await keyworks ?
Question 24

A developer is debugging a web server that uses Node.js The server hits a runtimeerror every third request to an important endpoint on the web server.
The developer added a break point to the start script, that is at index.js at he root of the server's source code. The developer wants to make use of chrome DevTools to debug.
Which command can be run to access DevTools and make sure the breakdown is hit ?
Question 25

Refer to the code below:
Async funct on functionUnderTest(isOK) {
If (isOK) return 'OK' ;
Throw new Error('not OK');
)
Which assertion accurately tests the above code?
Question 26

Consider type coercion, what does the following expression evaluate to?
True + 3 + '100' + null
Question 27

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 number in the array, The test passes:
Let res = sum2([1, 2, 3 ]) ; console.assert(res === 6 ); Res = sum3([ 1, 2, 3, 4]); console.assert(res=== 6); A different developer made changes to the behavior of sum3 to instead sum all of the numbers present in the array. The test passes:
Which two results occur when running the test on the updated sum3 function ?
Choose 2 answers
Question 28

A developer creates a simple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must be displayed in the console.
Here is the HTML file content:
<input type =" text" value="Hello" name ="input">
<button type ="button" >Display </button>
The developer wrote the javascript code below:
Const button = document.querySelector('button'); button.addEvenListener('click', () => ( Const input = document.querySelector('input'); console.log(input.getAttribute('value')); When the user clicks the button, the output is always "Hello".
What needs to be done make this code work as expected?
Question 29

A developer creates an object where its properties should be immutable and prevent properties from being added or modified.
Which method should be used to execute this business requirement ?
Question 30

A developer has an ErrorHandler module that contains multiple functions.
What kind of export be leverages so that multiple functions can be used?
Question