Spring Sale 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: save70

Download Latest JavaScript-Developer-I Questions

Salesforce Certified JavaScript Developer (JS-Dev-101) Questions and Answers

Question 21

A developer wants to use a try...catch statement to catch any error that countSheep() may throw and pass it to a handleError() function.

What is the correct implementation of the try...catch?

Options:

A.

setTimeout(function() {

try {

countSheep();

} catch (e) {

handleError(e);

}

}, 1000);

B.

try {

countSheep();

} finally {

handleError(e);

}

C.

try {

countSheep();

} handleError (e){

catch(e);

}

D.

try {

setTimeout(function() {

countSheep();

}, 1000);

} catch (e) {

handleError(e);

}

Question 22

A developer wants to use a module called DatePrettyPrint.

This module exports one default function called printDate().

How can the developer import and use printDate()?

Options:

A.

import DatePrettyPrint() from ' /path/DatePrettyPrint.js ' ;

printDate();

B.

import DatePrettyPrint from ' /path/DatePrettyPrint.js ' ;

DatePrettyPrint.printDate();

C.

import printDate from ' /path/DatePrettyPrint.js ' ;

DatePrettyPrint.printDate();

D.

import printDate from ' /path/DatePrettyPrint.js ' ;

printDate();

Question 23

After user acceptance testing, the developer is asked to change the webpage background based on the user’s location. It works on the developer’s computer but not on the tester’s machine.

Which two actions will help determine accurate results?

Options:

A.

The tester should disable their browser cache.

B.

The developer should inspect their browser refresh settings.

C.

The tester should clear their browser cache.

D.

The developer should rework the code.

Question 24

Refer to the code below (assuming Promise.race is intended):

let cat3 = new Promise(resolve = >

setTimeout(resolve, 3000, " Cat 3 completes " )

);

Promise.race([cat1, cat2, cat3])

.then(value = > {

let result = `${value} the race.`;

})

.catch(err = > {

console.log( " Race is cancelled: " , err);

});

(Assuming cat1 and cat2 are similar to earlier examples: cat2 resolves fastest.)

What is the value of result when Promise.race executes?

Options:

A.

Car 2 completed the race.

B.

Car 1 crashed on the race.

C.

Race is cancelled.

D.

Car 3 completed the race.