Summer Special 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: bestdeal

Free Salesforce JavaScript-Developer-I Practice Exam with Questions & Answers | Set: 4

Questions 31

A developer has the following arrayof hourly wages:

Let arr = (8, 5, 9, 75, 11, 25, 7, 75, , 13, 25);

For workers making less than $10 an hour rate should be multiple by 1.25 and returned in a new array.

How should the developer implement the request?

Options:
A.

let arrl = arr.filter((val) => val <10).map((num) -> num = 1.25);

B.

let arrl = arr .rr.acArray ((val) => ( val < 10 )) ,map((num) => { num * 1.25 ));

C.

let arrl = arr-map((num) => { return ran * 1.25 }).filter((val) -> { return val < 10));

D.

let arrl = arr.filterBy((val) => val < 10 ).aapBy<(num) -> num = ..25 );

Questions 32

A developer needs to debug a Node.js web server because a runtime error keeps occurring at one of the endpoints.

The developer wants totest 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 commandcan the developer use to open the CLI debugger in their current terminal window?

Options:
A.

node -i server.js

B.

node inspect server,js

C.

node server,js inspect

D.

node start inspect server,js

Questions 33

Given the HTML below:

JavaScript-Developer-I Question 33

Which statement adds thepriority-account css class to the Applied Shipping row?

Options:
A.

document.querySelector('#row-as').classList.add('priority-account');

Questions 34

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 two numbers present in the array.

JavaScript-Developer-I Question 34

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

Choose 2 answers

Options:
A.

The line 05 assertion passes.

B.

The line 02 assertion passes.

C.

Theline 02 assertion fails.

D.

The line 05 assertion fails.

Questions 35

Refer to the following code:

function test (val) {

If (val === undefined) {

return ‘Undefinedvalues!’ ;

}

if (val === null) {

return ‘Null value! ’;

}

return val;

}

Let x;

test(x);

What is returned by the function call on line 13?

Options:
A.

Undefined

B.

Line 13 throws an error.

C.

‘Undefined values!’

D.

‘Null value!’

Questions 36

Refer to the code below

let inArray = [[1,2],[3,4,5]];

which two statements results in the array [1,2,3,4,5]?

choose 2 answer

Options:
A.

[ ].concat(...inArray);

B.

[ ].concat.apply(inArray,[ ]);

C.

[ ].concat([...inArray])

D.

[ ].concat.apply([ ],inArray);

Questions 37

Which three statements are true about promises ?

Choose 3 answers

Options:
A.

The executor of a new Promise runs automatically.

B.

A Promise has a .then() method.

C.

A fulfilled or rejected promise will not change states .

D.

A settled promise can become resolved.

E.

A pending promise canbecome fulfilled, settled, or rejected.

Questions 38

Which code statement correctly retrieves and returns an object from localStorage?

Options:
A.

const retrieveFromLocalStorage = () =>{return JSON.stringify(window.localStorage.getItem(storageKey));}

B.

const retrieveFromLocalStorage = (storageKey) =>{return window.localStorage.getItem(storageKey);}

C.

const retrieveFromLocalStorage = (storageKey) =>{return JSON.parse(window.localStorage.getItem(storageKey));}

D.

constretrieveFromLocalStorage = (storageKey) =>{return window.localStorage[storageKey];}

Questions 39

Referto 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?"));

JavaScript-Developer-I Question 39

When does Promise.finally on line 08 get called?

Options:
A.

When rejected

B.

When resolved and settled

C.

When resolved

D.

When resolved or rejected

Questions 40

A developer is setting up a Node,js server and is creating a script at the root of the source code, index,js, that will start the server when executed. The developer declares a variable that needsthe folder location that the code executes from.

Which global variable can be used in the script?

Options:
A.

window.location

B.

_filename

C.

_dirname

D.

this.path

Salesforce Free Exams

Salesforce Free Exams
Examstrack provides free Salesforce exam prep materials and practice tests to support your Salesforce certification goals.