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

JavaScript-Developer-I Exam Dumps - Salesforce Developer Questions and Answers

Question # 24

A developer wrote the following code:

01 let x = object.value;

02

03 try {

04 handleObjectValue(x);

05 } catch(error) {

06 handleError(error);

07 }

The developer has a getNextValue function to execute after handleObjectValue(), but does not want to execute getNextValue() if an error occurs. How can the developer change the code to ensure this behavior?

Options:

A.

03 try {

04 handleObjectValue(x);

05 } catch(error) {

06 handleError(error);

07 } then {

08 getNextValue();

09 }

B.

03 try {

04 handleObjectValue(x);

05 getNextValue();

06 } catch(error) {

07 handleError(error);

08 }

C.

03 try {

04 handleObjectValue(x);

05 } catch(error) {

06 handleError(error);

07 }

08 getNextValue();

D.

03 try {

04 handleObjectValue(x);

05 } catch(error) {

06 handleError(error);

07 } finally {

08 getNextValue();

09 }

Buy Now
Question # 25

Which statement allows a developer to update the browser navigation history without a page refresh?

Options:

A.

window.customHistory.pushState(newStateObject, ' ' , null);

B.

window.history.createState(newStateObject, ' ' );

C.

window.history.pushState(newStateObject, ' ' , null);

D.

window.history.updateState(newStateObject, ' ' );

Buy Now
Question # 26

A developer at Universal Containers creates a new landing page based on HTML, CSS, and JavaScript.

To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed to do some custom initialization when the webpage is fully loaded with HTML content and all related files.

Which statement should be used to call personalizeWebsiteContent based on the above business requirement?

Options:

A.

document.addEventListener( ' DOMContentLoaded ' , personalizeWebsiteContent);

B.

document.addEventListener( ' onDOMContentLoaded ' , personalizeWebsiteContent);

C.

window.addEventListener( ' load ' , personalizeWebsiteContent);

D.

window.addEventListener( ' onload ' , personalizeWebsiteContent);

Buy Now
Question # 27

Refer to the code declarations below:

let str1 = ' Java ' ;

let str2 = ' Script ' ;

Which three expressions return the string JavaScript?

Options:

A.

`${str1}${str2}`

B.

str1.concat(str2);

C.

const({str1, str2});

D.

str1 + str2;

E.

str1.join(str2);

Buy Now
Question # 28

Given:

const str = ' Salesforce ' ;

Which two statements result in ' Sales ' ?

Options:

A.

str.substring(0, 5);

B.

str.substring(1, 5);

C.

str.substr(0, 5);

D.

str.substr(1, 5);

Buy Now
Question # 29

Original constructor function:

01 function Vehicle(name, price) {

02 this.name = name;

03 this.price = price;

04 }

05 Vehicle.prototype.priceInfo = function () {

06 return `Cost of the $(this.name) is $(this.price)$`;

07 }

08 var ford = new Vehicle( ' Ford Fiesta ' , ' 20,000 ' );

Which class definition is correct?

Options:

A.

class Vehicle {

constructor(name, price) {

this.name = name;

this.price = price;

}

priceInfo() {

return ' Cost of the ${this.name} is ${this.price}$ ' ;

}

}

B.

class Vehicle {

vehicle(name, price) {

this.name = name;

this.price = price;

}

priceInfo() {

return ' Cost of the ${this.name} is ${this.price}$ ' ;

}

}

C.

class Vehicle {

constructor() {

this.name = name;

this.price = price;

}

priceInfo() {

return `Cost of the ${this.name} is ${this.price}$`;

}

}

D.

class Vehicle {

constructor(name, price) {

this.name = name;

this.price = price;

}

priceInfo() {

return `Cost of the ${this.name} is ${this.price}$`;

}

}

Buy Now
Question # 30

Which statement accurately describes the behavior of the async/await keywords?

Options:

A.

The associated function sometimes returns a promise.

B.

The associated function can only be called via asynchronous methods.

C.

The associated class contains some asynchronous functions.

D.

The associated function is asynchronous, but acts like synchronous code.

Buy Now
Question # 31

Most accurate tests for:

const arr = Array(5).fill(0);

Options:

A.

console.assert(arr.length === 0);

B.

console.assert(arr[5] === 0 & & arr.length === 0);

C.

arr.forEach(e = > console.assert(e === 0));

D.

console.assert(arr.length === 5);

Buy Now
Question # 32

A developer executes:

document.cookie;

document.cookie = ' key=John Smith ' ;

What is the behavior?

Options:

A.

Cookies are read and the key value is set, the remaining cookies are unaffected.

B.

Cookies are read, but the key value is not set because the value is not URL encoded.

C.

Cookies are not read because line 01 should be document.cookies, but the key value is set and all cookies are wiped.

D.

Cookies are read and the key value is set, and all cookies are wiped.

Buy Now
Question # 33

Refer to the code below:

01 new Promise((resolve, reject) = > {

02 const fraction = Math.random();

03 if (fraction > 0.5) reject( ' fraction > 0.5, ' + fraction);

04 resolve(fraction);

05 })

06 .then(() = > console.log( ' resolved ' ))

07 .catch((error) = > console.error(error))

08 .finally(() = > console.log( ' when am I called? ' ));

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

Buy Now
Exam Name: Salesforce Certified JavaScript Developer (JS-Dev-101)
Last Update: Jun 19, 2026
Questions: 147
JavaScript-Developer-I pdf

JavaScript-Developer-I PDF

$25.5  $84.99
JavaScript-Developer-I Engine

JavaScript-Developer-I Testing Engine

$28.5  $94.99
JavaScript-Developer-I PDF + Engine

JavaScript-Developer-I PDF + Testing Engine

$40.5  $134.99