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

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

Questions 4

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
Questions 5

Refer to the code below:

01 async function functionUnderTest(isOK) {

02 if (isOK) return ' OK ' ;

03 throw new Error( ' not OK ' );

04 }

Which assertion accurately tests the above code?

Options:

A.

console.assert(await functionUnderTest(true), ' OK ' )

B.

console.assert(await (functionUnderTest(true), ' not OK ' ))

C.

console.assert(functionUnderTest(true), ' OK ' )

D.

console.assert(await functionUnderTest(true), ' not OK ' )

Buy Now
Questions 6

Refer to the following code:

< html lang= " en " >

< body >

< button class= " secondary " > Save draft < /button >

< button class= " primary " > Save and close < /button >

< /body >

< script >

function displaySaveMessage(event) {

console.log( ' Save message. ' );

}

function displaySuccessMessage(event) {

console.log( ' Success message. ' );

}

window.onload = function() {

document.querySelector( ' .secondary ' )

.addEventListener( ' click ' , displaySaveMessage, true);

document.querySelector( ' .primary ' )

.addEventListener( ' click ' , displaySuccessMessage, true);

}

< /script >

< /html >

Options:

A.

> Outer message

B.

> Outer message

Inner message

C.

> Inner message

D.

> Inner message

Outer message

Buy Now
Questions 7

Original code:

01 let requestPromise = client.getRequest;

03 requestPromise().then((response) = > {

04 handleResponse(response);

05 });

The developer wants to gracefully handle errors from a Promise-based GET request.

Which code modification is correct?

Options:

A.

try/catch around requestPromise().then(...)

B.

(duplicate of A)

C.

Add .catch to the Promise chain

D.

Use finally handler for errors

Buy Now
Questions 8

Given the JavaScript below:

function onLoad() {

console.log( " Page has loaded! " );

}

Where can the developer see the log statement after loading the page in the browser?

Options:

A.

On the browser JavaScript console

B.

On the terminal console running the web server

C.

In the browser performance tools log

D.

On the webpage console log

Buy Now
Questions 9

Refer to the following code:

01 let obj = {

02 foo: 1,

03 bar: 2

04 }

05 let output = []

06

07 for (let something of obj) {

08 output.push(something);

09 }

10

11 console.log(output);

What is the value of output on line 11?

Options:

A.

An error will occur due to the incorrect usage of the for_of statement on line 07.

B.

[1, 2]

C.

[ " foo " , " bar " ]

D.

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

Buy Now
Questions 10

Given the code:

const copy = JSON.stringify([new String( ' false ' ), new Boolean(false), undefined]);

What is the value of copy?

Options:

A.

' [ " false " , false, null] '

B.

' [false, {}] '

C.

' [ " false " , false, undefined] '

D.

' [ " false " , {}] '

Buy Now
Questions 11

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

}

Buy Now
Questions 12

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

Buy Now
Questions 13

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 after the code executes?

Options:

A.

low

B.

10

C.

5

D.

undefined

Buy Now
Questions 14

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.

Buy Now
Questions 15

Refer to the code below:

let productSKU = ' 8675309 ' ;

A developer has a requirement to generate SKU numbers that are always 19 characters long, starting with ' sku ' , and padded with zeros.

Which statement assigns the value sku000000008675309?

Options:

A.

productSKU = productSKU.padEnd(16, ' 0 ' ).padStart( ' sku ' );

B.

productSKU = productSKU.padStart(16, ' 0 ' ).padStart(19, ' sku ' );

C.

productSKU = productSKU.padEnd(16, ' 0 ' ).padStart(19, ' sku ' );

D.

productSKU = productSKU.padStart(19, ' 0 ' ).padStart( ' sku ' );

Buy Now
Questions 16

Given the following code:

01 counter = 0;

02 const logCounter = () = > {

03 console.log(counter);

04 };

05 logCounter();

06 setTimeout(logCounter, 2100);

07 setInterval(() = > {

08 counter++;

09 logCounter();

10 }, 1000);

What will be the first four numbers logged?

Options:

A.

0122

B.

0123

C.

0112

D.

0012

Buy Now
Questions 17

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
Questions 18

Corrected code:

let a = " * " ;

let b = " ** " ;

// x = 3;

console.log(a);

What is displayed when the code executes?

Options:

A.

ReferenceError: a is not defined

B.

*

C.

undefined

D.

null

Buy Now
Questions 19

A developer is asked to fix some bugs reported by users. To do that, the developer adds a breakpoint for debugging.

01 function Car(maxSpeed, color) {

02 this.maxSpeed = maxSpeed;

03 this.color = color;

04 }

05 let carSpeed = document.getElementById( ' carSpeed ' );

06 debugger;

07 let fourWheels = new Car(carSpeed.value, ' red ' );

When the code execution stops at the breakpoint on line 06, which two types of information are available in the browser console?

Options:

A.

A variable displaying the number of instances created for the Car object

B.

The information stored in the window.localStorage property

C.

The values of the carSpeed and fourWheels variables

D.

The style, event listeners and other attributes applied to the carSpeed DOM element

Buy Now
Questions 20

Refer to the following object:

01 const cat = {

02 firstName: ' Fancy ' ,

03 lastName: ' Whiskers ' ,

04 get fullName(){

05 return this.firstName + ' ' + this.lastName;

06 }

07 };

How can a developer access the fullName property for cat?

Options:

A.

cat.fullName()

B.

cat.get.fullName

C.

cat.function.fullName()

D.

cat.fullName

Buy Now
Questions 21

A developer has two ways to write a function:

Option A:

01 function Monster() {

02 this.growl = () = > {

03 console.log( " Grr! " );

04 }

05 }

Option B:

01 function Monster() {};

02 Monster.prototype.growl = () = > {

03 console.log( " Grr! " );

04 }

After deciding on an option, the developer creates 1000 monster objects. How many growl methods are created with Option A and Option B?

Options:

A.

1000 growl methods are created regardless of which option is used.

B.

1 growl method is created regardless of which option is used.

C.

1000 growl methods are created for Option A. 1 growl method is created for Option B.

D.

1 growl method is created for Option A. 1000 growl methods are created for Option B.

Buy Now
Questions 22

Refer to the HTML below:

< div id= " main " >

< ul >

< li > Leo < /li >

< li > Tony < /li >

< li > Tiger < /li >

< /ul >

< /div >

Which JavaScript statement results in changing " Leo " to " The Lion " ?

Options:

A.

document.querySelectorAll( ' #main #Leo ' ).innerHTML = ' The Lion ' ;

B.

document.querySelector( ' #main li:second-child ' ).innerHTML = ' The Lion ' ;

C.

document.querySelectorAll( ' #main li,Leo ' ).innerHTML = ' The Lion ' ;

D.

document.querySelector( ' #main li:nth-child(1) ' ).innerHTML = ' The Lion ' ;

Buy Now
Questions 23

A developer initiates a server with the file server.js and adds dependencies in the source code ' s package.json that are required to run the server.

Which command should the developer run to start the server locally?

Options:

A.

node start

B.

npm start

C.

npm start server.js

D.

start server.js

Buy Now
Questions 24

Refer to the code below:

flag();

function flag() {

console.log( ' flag ' );

}

const anotherFlag = () = > {

console.log( ' another flag ' );

}

anotherFlag();

What is result of the code block?

Options:

A.

The console logs only ' flag ' .

B.

An error is thrown.

C.

The console logs ' flag ' and then an error is thrown.

D.

The console logs ' flag ' and ' another flag ' .

Buy Now
Questions 25

A developer has a fizzbuzz function that, when passed in a number, returns the following:

    ' fizz ' if the number is divisible by 3.

    ' buzz ' if the number is divisible by 5.

    ' fizzbuzz ' if the number is divisible by both 3 and 5.

    Empty string ' ' if the number is divisible by neither 3 nor 5.

Which two test cases properly test scenarios for the fizzbuzz function?

Options:

A.

let res = fizzbuzz(true);

console.assert(res === ' ' );

B.

let res = fizzbuzz(3);

console.assert(res === ' ' );

C.

let res = fizzbuzz(5);

console.assert(res === ' fizz ' );

D.

let res = fizzbuzz(15);

console.assert(res === ' fizzbuzz ' );

Buy Now
Questions 26

Which two console logs output NaN?

Options:

A.

console.log(10 / 0);

B.

console.log(parseInt( ' two ' ));

C.

console.log(10 / Number( ' 5 ' ));

D.

console.log(10 / ' five ' );

Buy Now
Questions 27

Refer to the code below:

let strNumber = ' 12345 ' ;

Which code snippet shows a correct way to convert this string to an integer?

Options:

A.

let numberValue = Integer(strNumber);

B.

let numberValue = textValue.toInteger();

C.

let numberValue = Number(strNumber);

D.

let numberValue = (number) textValue;

Buy Now
Questions 28

Considering type coercion, what does the following expression evaluate to?

true + ' 13 ' + NaN

Options:

A.

' true13NaN '

B.

' 113NaN '

C.

14

D.

' true13 '

Buy Now
Questions 29

Refer to the code below:

< html >

< body >

< div id= " logo " > Hello Logo! < /div >

< button id= " test " > Click me < /button >

< /body >

< script >

function printMessage(event) {

console.log( ' This is a test message ' );

}

let el = document.getElementById( ' test ' );

el.addEventListener( " click " , printMessage, false);

< /script >

< /html >

Which action should be done?

Options:

A.

Add event.removeEventListener(); to window.onload event handler

B.

Add event.removeEventListener(); to printMessage function

C.

Add event.stopPropagation(); to printMessage function

D.

Add event.stopPropagation(); to window.onload event handler

Buy Now
Questions 30

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

Options:

A.

value === Number.NaN

B.

value == NaN

C.

Object.is(value, NaN)

D.

value !== value

E.

Number.isNaN(value)

Buy Now
Questions 31

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
Questions 32

01 function Monster() { this.name = ' hello ' ; };

02 const m = Monster();

What happens due to the missing new keyword?

Options:

A.

The m variable is assigned the correct object.

B.

window.name is assigned to ' hello ' and the variable m remains undefined.

C.

window.m is assigned the correct object.

D.

The m variable is assigned the correct object but this.name remains undefined.

Buy Now
Questions 33

A developer has a fizzbuzz function that, when passed in a number, returns the following:

    ' fizz ' if the number is divisible by 3.

    ' buzz ' if the number is divisible by 5.

    ' fizzbuzz ' if the number is divisible by both 3 and 5.

    Empty string if the number is divisible by neither 3 nor 5.

Which two test cases properly test scenarios for the fizzbuzz function?

Options:

A.

let res = fizzbuzz(3);

console.assert(res === ' buzz ' );

B.

let res = fizzbuzz(15);

console.assert(res === ' fizzbuzz ' );

C.

let res = fizzbuzz(NaN);

console.assert(isNaN(res));

D.

let res = fizzbuzz(Infinity);

console.assert(res === ' ' );

Buy Now
Questions 34

Refer to the code snippet:

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 the code executes?

Options:

A.

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

B.

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

C.

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

D.

[1, 2, 3, 5]

Buy Now
Questions 35

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.

01 const sumFunction = arr = > {

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

03 //

04 result += current;

05 //

06 }, 10);

07 };

Which line replacement makes the code work as expected?

Options:

A.

03 if(arr.length == 0) { return 0; }

B.

04 result = result + current;

C.

02 arr.map((result, current) = > {

D.

05 return result;

Buy Now
Questions 36

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
Questions 37

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! ' ); };

Buy Now
Questions 38

Given the following code:

let x = ( ' 15 ' + 10) * 2;

What is the value of x?

Options:

A.

1520

B.

3020

C.

50

D.

35

Buy Now
Questions 39

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
Questions 40

Code:

01 const sayHello = (name) = > {

02 console.log( ' Hello ' , name);

03 };

04

05 const world = () = > {

06 return ' World ' ;

07 };

08

09 sayHello(world);

This does not print " Hello World " .

What change is needed?

Options:

A.

Change line 2 to console.log( ' Hello ' , name());

B.

Change line 7 to }();

C.

Change line 9 to sayHello(world)();

D.

Change line 5 to function world() {

Buy Now
Questions 41

A developer is trying to convince management that their team will benefit from using Node.js for a backend server that they are going to create. The server will be a web server that handles API requests from a website that the team has already built using HTML, CSS, and JavaScript.

Which three benefits of Node.js can the developer use to persuade their manager?

Options:

A.

Executes server-side JavaScript code to avoid learning a new language.

B.

Performs a static analysis on code before execution to look for runtime errors.

C.

Uses non-blocking functionality for performant request handling.

D.

Ensures stability with one major release every few years.

E.

Installs with its own package manager to install and manage third-party libraries.

Buy Now
Questions 42

Console logging methods that allow string substitution:

Options:

A.

message

B.

log

C.

assert

D.

info

E.

error

Buy Now
Questions 43

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.

Buy Now
Questions 44

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
Exam Name: Salesforce Certified JavaScript Developer (JS-Dev-101)
Last Update: Jun 26, 2026
Questions: 147

PDF + Testing Engine

$49.5  $164.99

Testing Engine

$37.5  $124.99
buy now JavaScript-Developer-I testing engine

PDF (Q&A)

$31.5  $104.99
buy now JavaScript-Developer-I pdf
dumpsmate guaranteed to pass

24/7 Customer Support

DumpsMate's team of experts is always available to respond your queries on exam preparation. Get professional answers on any topic of the certification syllabus. Our experts will thoroughly satisfy you.

Site Secure

mcafee secure

TESTED 26 Jun 2026