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

ExamsBrite Dumps

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

Salesforce Certified JavaScript Developer (JS-Dev-101)

Last Update Jun 27, 2026
Total Questions : 147

We are offering FREE JavaScript-Developer-I Salesforce exam questions. All you do is to just go and sign up. Give your details, prepare JavaScript-Developer-I free exam questions and then go for complete pool of Salesforce Certified JavaScript Developer (JS-Dev-101) test questions that will help you more.

JavaScript-Developer-I pdf

JavaScript-Developer-I PDF

$36.75  $104.99
JavaScript-Developer-I Engine

JavaScript-Developer-I Testing Engine

$43.75  $124.99
JavaScript-Developer-I PDF + Engine

JavaScript-Developer-I PDF + Testing Engine

$57.75  $164.99
Questions 1

Given the HTML below:

< div >

< div id= " row-uc " > Universal Containers < /div >

< div id= " row-as " > Applied Shipping < /div >

< div id= " row-bt " > Burlington Textiles < /div >

< /div >

Which statement adds the priority-account CSS class to the Applied Shipping row?

Options:

A.  

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

B.  

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

C.  

document.querySelector( ' #row-as ' ).classes.push( ' priority-account ' );

D.  

document.getElementById( ' row-as ' ).addClass( ' priority-account ' );

Discussion 0
Questions 2

Given the JavaScript below:

01 function filterDOM(searchString){

02 const parsedSearchString = searchString & & searchString.toLowerCase();

03 document.querySelectorAll( ' .account ' ).forEach(account = > {

04 const accountName = account.innerHTML.toLowerCase();

05 account.style.display = accountName.includes(parsedSearchString) ? /* Insert code here */;

06 });

07 }

Which code should replace the placeholder comment on line 05 to hide accounts that do not match the search string?

Options:

A.  

' block ' : ' none '

B.  

' hidden ' : ' visible '

C.  

' visible ' : ' hidden '

D.  

' none ' : ' block '

Discussion 0
Questions 3

Given the code below:

01 setTimeout(() = > {

02 console.log(1);

03 }, 1100);

04 console.log(2);

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

06 setTimeout(() = > {

07 reject(console.log(3));

08 }, 1000);

09 }).catch(() = > {

10 console.log(4);

11 });

12 console.log(5);

What is logged to the console?

Options:

A.  

25341

B.  

12435

C.  

12534

D.  

21435

Discussion 0
Questions 4

Refer to the code below:

const pi = 3.1415926;

What is the data type of pi?

Options:

A.  

Number

B.  

Float

C.  

Double

D.  

Decimal

Discussion 0
Questions 5

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);

Discussion 0
Questions 6

HTML:

< p > The current status of an Order: < span id= " status " > In Progress < /span > < /p >

Which JavaScript statement changes ' In Progress ' to ' Completed ' ?

Options:

A.  

document.getElementById( " .status " ).innerHTML = ' Completed ' ;

B.  

document.getElementById( " #status " ).innerHTML = ' Completed ' ;

C.  

document.getElementById( " status " ).innerHTML = ' Completed ' ;

D.  

document.getElementById( " status " ).Value = ' Completed ' ;

Discussion 0
Questions 7

A developer is setting up a new Node.js server with a client library that is built using events and callbacks.

The library:

    Will establish a web socket connection and handle receipt of messages to the server.

    Will be imported with require, and made available with a variable called ws.

    The developer also wants to add error logging if a connection fails.

Given this information, which code segment shows the correct way to set up a client with two events that listen at execution time?

Options:

A.  

ws.connect(() = > {

console.log( ' Connected to client ' );

}).catch((error) = > {

console.log( ' ERROR ' , error);

});

B.  

ws.on( ' connect ' , () = > {

console.log( ' Connected to client ' );

});

ws.on( ' error ' , (error) = > {

console.log( ' ERROR ' , error);

});

C.  

ws.on( ' connect ' , () = > {

console.log( ' Connected to client ' );

});

ws.on( ' error ' , (error) = > {

console.log( ' ERROR ' , error);

});

D.  

try {

ws.connect(() = > {

console.log( ' Connected to client ' );

});

} catch(error) {

console.log( ' ERROR ' , error);

}

Discussion 0
Questions 8

Refer to the code:

const pi = 3.1415926;

What is the data type of pi?

Options:

A.  

Float

B.  

Double

C.  

Decimal

D.  

Number

Discussion 0
Questions 9

Refer to the code below:

01 function changeValue(param) {

02 param = 5;

03 }

04 let a = 10;

05 let b = a;

06

07 changeValue(b);

08 const result = a + ' - ' + b;

What is the value of result when the code executes?

Options:

A.  

5-5

B.  

5-10

C.  

10-5

D.  

10-10

Discussion 0
Questions 10

Refer to the code below:

01 const objBook = {

02 title: ' JavaScript ' ,

03 };

04 Object.preventExtensions(objBook);

05 const newObjBook = objBook;

06 newObjBook.author = ' Robert ' ;

What are the values of objBook and newObjBook respectively?

Options:

A.  

{ title: " JavaScript " }

{ title: " JavaScript " }

B.  

{ author: " Robert " , title: " JavaScript " }

undefined

C.  

{ author: " Robert " }

{ author: " Robert " , title: " JavaScript " }

D.  

{ author: " Robert " , title: " JavaScript " }

{ author: " Robert " , title: " JavaScript " }

Discussion 0
Questions 11

JavaScript:

01 function Tiger() {

02 this.type = ' Cat ' ;

03 this.size = ' large ' ;

04 }

05

06 let tony = new Tiger();

07 tony.roar = () = > {

08 console.log( ' They\ ' re great! ' );

09 };

10

11 function Lion() {

12 this.type = ' Cat ' ;

13 this.size = ' large ' ;

14 }

15

16 let leo = new Lion();

17 // Insert code here

18 leo.roar();

Which two statements could be inserted at line 17 to enable line 18?

Options:

A.  

leo.roar = () = > { console.log( ' They\ ' re pretty good! ' ); };

B.  

Object.assign(leo, tony);

C.  

Object.assign(leo, Tiger);

D.  

leo.prototype.roar = () = > { console.log( ' They\ ' re pretty good! ' ); };

Discussion 0
Questions 12

At Universal Containers, every team has its own way of copying JavaScript objects. The code snippet shows an implementation from one team:

01 function Person() {

02 this.firstName = " John " ;

03 this.lastName = " Doe " ;

04 this.name = () = > {

05 console.log( ' Hello ${this.firstName} ${this.lastName} ' );

06 }

07 }

08

09 const john = new Person();

10 const dan = JSON.parse(JSON.stringify(john)); // (intended deep copy)

11 dan.firstName = ' Dan ' ;

12 dan.name();

(Original line 10 is logically intended to be JSON.parse(JSON.stringify(john)) to perform a JSON clone.)

What is the output of the code execution?

Options:

A.  

Hello John Doe

B.  

Hello Dan Doe

C.  

TypeError: dan.name is not a function

D.  

Hello Dan

Discussion 0
Questions 13

Given the following code:

01 let x = null;

02 console.log(typeof x);

What is the output of line 02?

Options:

A.  

" object "

B.  

" undefined "

C.  

" x "

D.  

" null "

Discussion 0
Questions 14

Refer to the code below:

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

Which two statements result in the array [1, 2, 3, 4, 5]?

(With corrected typing errors: usArray → inArray, .. → ....)

Options:

A.  

[].concat(...inArray);

B.  

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

C.  

[].concat::...inArray();

D.  

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

Discussion 0
Questions 15

Refer to the following code:

01 class Ship {

02 constructor(size) {

03 this.size = size;

04 }

05 }

06

07 class FishingBoat extends Ship {

08 constructor(size, capacity){

09 //Missing code

10 this.capacity = capacity;

11 }

12 displayCapacity() {

13 console.log( ' The boat has a capacity of ${this.capacity} people. ' );

14 }

15 }

16

17 let myBoat = new FishingBoat( ' medium ' , 10);

18 myBoat.displayCapacity();

Which statement should be added to line 09 for the code to display

The boat has a capacity of 10 people?

Options:

A.  

super(size);

B.  

ship.size = size;

C.  

super.size = size;

D.  

this.size = size;

Discussion 0
Questions 16

Refer to the code below:

01 let first = ' Who ' ;

02 let second = ' What ' ;

03 try {

04 try {

05 throw new Error( ' Sad trombone ' );

06 } catch (err) {

07 first = ' Why ' ;

08 throw err;

09 } finally {

10 second = ' When ' ;

11 }

12 } catch (err) {

13 second = ' Where ' ;

14 }

What are the values for first and second once the code executes?

Options:

A.  

first is Who and second is Where.

B.  

first is Why and second is Where.

C.  

first is Who and second is When.

D.  

first is Why and second is When.

Discussion 0
Questions 17

Refer to the code below:

01 < html lang= " en " >

02 < table onclick= " console.log( ' Table log ' ); " >

03 < tr id= " row1 " >

04 < td > Click me! < /td >

05 < /tr >

06 < /table >

07 < script >

08 function printMessage(event) {

09 console.log( ' Row log ' );

10 event.stopPropagation();

11 }

12

13 let elem = document.getElementById( ' row1 ' );

14 elem.addEventListener( ' click ' , printMessage, false);

15 < /script >

16 < /html >

Which code change should be done for the console to log the following when " Click me! " is clicked?

Row log

Table log

Options:

A.  

Change line 14 to elem.addEventListener( ' click ' , printMessage, true);

B.  

Remove lines 13 and 14

C.  

Change line 10 to event.stopPropagation(false);

D.  

Remove line 10

Discussion 0
Questions 18

Given the code below:

01 setCurrentUrl();

02 console.log( " The current URL is: " + url);

03

04 function setCurrentUrl() {

05 url = window.location.href;

06 }

What happens when the code executes?

Options:

A.  

The url variable has global scope and line 02 throws an error.

B.  

The url variable has global scope and line 02 executes correctly.

C.  

The url variable has local scope and line 02 executes correctly.

D.  

The url variable has local scope and line 02 throws an error.

Discussion 0
Questions 19

Refer to the code below:

01 const myFunction = arr = > {

02 return arr.reduce((result, current) = > {

03 return result + current;

04 }, 10);

05 }

What is the output of this function when called with an empty array?

Options:

A.  

Returns 0

B.  

Throws an error

C.  

Returns NaN

D.  

Returns 5 ← (Text here appears to be a typo; correct value is 10, see explanation.)

Discussion 0
Questions 20

Refer to the code:

01 function execute() {

02 return new Promise((resolve, reject) = > reject());

03 }

04 let promise = execute();

05

06 promise

07 .then(() = > console.log( ' Resolved1 ' ))

08 .then(() = > console.log( ' Resolved2 ' ))

09 .then(() = > console.log( ' Resolved3 ' ))

10 .catch(() = > console.log( ' Rejected ' ))

11 .then(() = > console.log( ' Resolved4 ' ));

What is the result when the Promise in the execute function is rejected?

Options:

A.  

Resolved1 Resolved2 Resolved3 Rejected Resolved4

B.  

Rejected

C.  

Resolved1 Resolved2 Resolved3 Resolved4

D.  

Rejected Resolved4

Discussion 0
Questions 21

A team at Universal Containers works on a big project and uses yarn to manage the project ' s dependencies.

A developer added a dependency to manipulate dates and pushed the updates to the remote repository. The rest of the team complains that the dependency does not get downloaded when they execute yarn .

What could be the reason for this?

Options:

A.  

The developer added the dependency as a dev dependency, and YARN_ENV is set to production.

B.  

The developer missed the option --save when adding the dependency.

C.  

The developer added the dependency as a dev dependency, and NODE_ENV is set to production.

D.  

The developer missed the option --add when adding the dependency.

Discussion 0
Questions 22

Corrected code:

let obj = {

foo: 1,

bar: 2

};

let output = [];

for (let something in obj) {

output.push(something);

}

console.log(output);

What is the output of line 11?

Options:

A.  

[ " bar " , " foo " ]

B.  

[1, 2]

C.  

[ " foo " , " bar " ]

D.  

[ " foo:1 " , " bar:2 " ]

Discussion 0
Questions 23

Given the code below:

let numValue = 1982;

Which three code segments result in a correct conversion from number to string?

Options:

A.  

let strValue = numValue.toText();

B.  

let strValue = String(numValue);

C.  

let strValue = ' ' + numValue;

D.  

let strValue = numValue.toString();

E.  

let strValue = (String)numValue;

Discussion 0
Questions 24

Refer to the code:

01 console.log( ' Start ' );

02 Promise.resolve( ' Success ' ).then(function(value) {

03 console.log( ' Success ' );

04 });

05 console.log( ' End ' );

What is the output after the code executes successfully?

Options:

A.  

Start

Success

End

B.  

Start

End

Success

C.  

End

Start

Success

D.  

Success

Start

End

Discussion 0
Questions 25

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

Discussion 0
Questions 26

A developer uses a parsed JSON string to work with user information as in the block below:

01 const userInformation = {

02 " id " : " user-01 " ,

03 " email " : " user01@universalcontainers.demo " ,

04 " age " : 25

05 };

Which two options access the email attribute in the object?

Options:

A.  

userInformation.email

B.  

userInformation.get( " email " )

C.  

userInformation[ " email " ]

D.  

userInformation[email]

Discussion 0
Questions 27

Refer to the code below:

01 let o = {

02 get js() {

03 let city1 = String( ' St. Louis ' );

04 let city2 = String( ' New York ' );

05

06 return {

07 firstCity: city1.toLowerCase(),

08 secondCity: city2.toLowerCase(),

09 }

10 }

11 }

What value can a developer expect when referencing o.js.secondCity?

Options:

A.  

undefined

B.  

An error

C.  

' New York '

D.  

' new york '

Discussion 0
Questions 28

Refer to the code below:

01 const addBy = ?

02 const addByEight = addBy(8);

03 const sum = addByEight(50);

Which two functions can replace line 01 and return 58 to sum?

Options:

A.  

const addBy = function(num1) {

return function(num2) {

return num1 + num2;

}

}

B.  

const addBy = function(num1) {

return num1 * num2;

}

C.  

const addBy = (num1) = > num1 + num2;

D.  

(Corrected for typing errors)

const addBy = (num1) = > {

return function(num2) {

return num1 + num2;

}

}

Discussion 0
Questions 29

A test searches for:

< button class= " blue " > Checkout < /button >

But the actual HTML is:

< button > Checkout < /button >

The test fails because it expects a class that no longer exists.

What type of test outcome is this?

Options:

A.  

False negative

B.  

True positive

C.  

True negative

D.  

False positive

Discussion 0
Questions 30

A developer wants to advocate for a mature, well-supported web framework/library instead of a new one (Minimalist.js).

Which two should be recommended?

Options:

A.  

React

B.  

Koa

C.  

Vue

D.  

Express

Discussion 0
Questions 31

Which statement accurately describes an aspect of promises?

Options:

A.  

Arguments for the callback function passed to .then() are optional.

B.  

.then() cannot be added after a catch.

C.  

.then() manipulates and returns the original promise.

D.  

In a .then() function, returning results is not necessary since callbacks will catch the result of a previous promise.

Discussion 0
Questions 32

A developer publishes a new version of a package with new features that do not break backward compatibility. The previous version number was 1.1.3.

Following semantic versioning formats, what should the new package version number be?

Options:

A.  

1.2.3

B.  

1.1.4

C.  

2.0.0

D.  

1.2.0

Discussion 0
Questions 33

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.

Discussion 0
Questions 34

Which option is true about the strict mode in imported modules?

Options:

A.  

Add the statement use non-strict; before any other statements in the module to enable notstrict mode.

B.  

Imported modules are in strict mode whether you declare them as such or not.

C.  

Add the statement use strict = false; before any other statements in the module to enable notstrict mode.

D.  

A developer can only reference notStrict() functions from the imported module.

Discussion 0
Questions 35

Refer to the following code block (with corrected template literals using backticks):

01 class Animal {

02 constructor(name) {

03 this.name = name;

04 }

05

06 makeSound() {

07 console.log(`${this.name} is making a sound.`);

08 }

09 }

10

11 class Dog extends Animal {

12 constructor(name) {

13 super(name);

14 this.name = name;

15 }

16 makeSound() {

17 console.log(`${this.name} is barking.`);

18 }

19 }

20

21 let myDog = new Dog( ' Puppy ' );

22 myDog.makeSound();

What is the console output?

Options:

A.  

> Uncaught ReferenceError

B.  

> Undefined

C.  

> Puppy is barking.

Discussion 0
Questions 36

A developer has an isDeg function that takes one argument, pts. They want to schedule the function to run every minute.

What is the correct syntax for scheduling this function?

Options:

A.  

setInterval(isDeg( ' cat ' ), 60000);

B.  

setInterval(isDeg, 60000, ' cat ' );

C.  

setTimeout(isDeg, 60000, ' cat ' );

D.  

setTimeout(isDeg( ' cat ' ), 60000);

Discussion 0
Questions 37

Refer to the code:

01 const exec = (item, delay) = >

02 new Promise(resolve = > setTimeout(() = > resolve(item), delay));

03

04 async function runParallel() {

05 const [result1, result2, result3] = await Promise.all(

06 [exec( ' x ' , ' 100 ' ), exec( ' y ' , ' 500 ' ), exec( ' z ' , ' 100 ' )]

07 );

08 return `parallel is done: ${result1}${result2}${result3}`;

09 }

Which two statements correctly execute runParallel()?

Options:

A.  

async runParallel().then(data);

B.  

runParallel().then(function(data){

return data;

});

C.  

runParallel().done(function(data){

return data;

});

D.  

runParallel().then(data);

Discussion 0
Questions 38

Console logging methods that allow string substitution:

Options:

A.  

message

B.  

log

C.  

assert

D.  

info

E.  

error

Discussion 0
Questions 39

Code:

01 let array = [1, 2, 3, 4, 4, 5, 4, 4];

02 for (let i = 0; i < array.length; i++) {

03 if (array[i] === 4) {

04 array.splice(i, 1);

05 i--;

06 }

07 }

What is the value of array after execution?

Options:

A.  

[1,2,3,4,5,4]

B.  

[1,2,3,5]

C.  

[1,2,3,4,5,4,4]

D.  

[1,2,3,4,4,5,4]

Discussion 0
Questions 40

01 function changeValue(obj) {

02 obj.value = obj.value / 2;

03 }

04 const objA = { value: 10 };

05 const objB = objA;

06

07 changeValue(objB);

08 const result = objA.value;

What is the value of result?

Options:

A.  

undefined

B.  

5

C.  

NaN

D.  

10

Discussion 0
Questions 41

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);

Discussion 0
Questions 42

A developer imports:

import printPrice from ' /path/PricePrettyPrint.js ' ;

What must be true about printPrice for this import to work?

Options:

A.  

printPrice must be a named export

B.  

printPrice must be an all export

C.  

printPrice must be the default export

D.  

printPrice must be a multi export

Discussion 0
Questions 43

Given a value, which two options can a developer use to detect if the value is NaN?

Options:

A.  

value === Number.NaN

B.  

value == NaN

C.  

isNaN(value)

D.  

Object.is(value, NaN)

Discussion 0
Questions 44

A developer publishes a new version of a package with bug fixes but no breaking changes. The old version number was 2.1.1.

What should the new package version number be based on semantic versioning?

Options:

A.  

2.1.2

B.  

2.2.0

C.  

2.2.1

D.  

3.1.1

Discussion 0