Winter Sale Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: s2p65

Easiest Solution 2 Pass Your Certification Exams

JavaScript-Developer-I Salesforce Certified JavaScript Developer (JS-Dev-101) Free Practice Exam Questions (2025 Updated)

Prepare effectively for your Salesforce JavaScript-Developer-I Salesforce Certified JavaScript Developer (JS-Dev-101) certification with our extensive collection of free, high-quality practice questions. Each question is designed to mirror the actual exam format and objectives, complete with comprehensive answers and detailed explanations. Our materials are regularly updated for 2025, ensuring you have the most current resources to build confidence and succeed on your first attempt.

Page: 1 / 4
Total 219 questions

Given two expressions var1 and var2. What are two valid ways to return the logical AND

of the two expressions and ensure it is data type Boolean ?

Choose 2 answers:

A.

Boolean(var1 && var2)

B.

var1 && var2

C.

var1.toBoolean() && var2toBoolean()

D.

Boolean(var1) && Boolean(var2)

Refer to the code below:

Considering that JavaScript is single-threaded, what is the output of line 08 after the code executes?

A.

10

B.

11

C.

12

D.

13

Whichthree actions can be using the JavaScript browser console?

Choose 3 answers:

A.

View and change DOM the page.

B.

Display a report showing the performance of a page.

C.

Run code that is not related to page.

D.

view , change, and debug the JavaScript code ofthe page.

E.

View and change security cookies.

A test has a dependency on database. query. During the test, the dependency is replaced with an object called database with the method,

Calculator query, that returns an array. The developer does notneed to verify how many times the method has been called.

Which two test approaches describe the requirement?

Choose 2 answers

A.

White box

B.

Stubbing

C.

Black box

D.

Substitution

A test has a dependency on database.query. During the test the dependency is replaced

with an object called database with the method, query, that returns an array. The

developer needs to verify how many times the method was called and the arguments

used each time.

Which two test approaches describe the requirement?

Choose 2 answers

A.

Integration

B.

Black box

C.

White box

D.

Mocking

A developer wrote a fizzbuzz function thatwhen 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 or 5.

Whichtwo test cases will properly test scenarios for the fizzbuzz function?

Choose 2 answers

A.

let res = fizzbuzz(5);console.assert ( res === ‘ ’ );

B.

let res = fizzbuzz(15);console.assert ( res === ‘ fizzbuzz ’ )

C.

let res = fizzbuzz(Infinity);console.assert ( res === ‘ ’ )

D.

let res = fizzbuzz(3);console.assert ( res === ‘ buzz ’ )

Refer to the following code:

Let sampleText = ‘The quick brown fox jumps’;

A developer needs to determine if a certainsubstring is part of a string.

Which three expressions return true for the given substring ?

Choose 3 answers

A.

sampleText.includes(‘fox’);

B.

sampleText.includes(‘ quick ’, 4);

C.

sampleText.includes(‘ Fox ’, 3)

D.

sampleText.includes(‘ fox ’);

E.

sampleText.includes(‘ quick ’) !== -1;

Refer to thefollowing code that imports a module named utils:

import (foo, bar) from ‘/path/Utils.js’;

foo() ;

bar() ;

Which two implementations of Utils.js export foo and bar such that the code above runs without

error?

Choose 2 answers

A.

// FooUtils.js and BarUtils.js existImport (foo) from ‘/path/FooUtils.js’;Import (boo) from ‘ /path/NarUtils.js’;

B.

const foo = () => { return ‘foo’ ; }const bar = () => { return ‘bar’ ; }export { bar, foo }

C.

Export default class {foo() { return ‘foo’ ; }bar() { return ‘bar’ ; }}

D.

const foo = () => { return ‘foo’;}const bar = () => {return ‘bar’; }Export default foo, bar;

Given the code below:

const copy = JSON.stringify([ newString(‘ false ’), new Bollean( false ), undefined ]);

What is the value of copy?

A.

-- [ \”false\” , { } ]--

B.

-- [ false, { } ]--

C.

-- [ \”false\” , false, undefined ]--

D.

-- [ \”false\” ,false, null ]--

Given code below:

setTimeout (()=> (

console.log(1);

). 0);

console.log(2);

New Promise ((resolve, reject )) = > (

setTimeout(() => (

reject(console.log(3));

). 1000);

)).catch(() => (

console.log(4);

));

console.log(5);

What is logged to the console?

A.

2 1 4 3 5

B.

2 5 1 3 4

C.

1 2 43 5

D.

1 2 5 3 4

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.

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

Choose 2 answers

A.

The line 05 assertion passes.

B.

The line 02 assertion passes.

C.

The line 02 assertion fails.

D.

The line 05 assertion fails.

Refer to the code below:

Line 05 causes an error.

What are the values of greeting and salutation once code completes?

A.

Greeting is Hello and salutation is Hello, Hello.

B.

Greeting is Goodbye and salutation is Hello, Hello.

C.

Greeting is Goodbye and salutation is I say Hello.

D.

Greeting is Hello and salutation is I say hello.

A developer has the following array of 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?

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

A developer at Universal Containers is creating their new landing pagebased on HTML, CSS, and JavaScript. The website includes multiple external resources that are loaded when the page is opened.

To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed when the webpage isloaded and there is no need to wait for the resources to be available.

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

A.

windows,addEventListener('load', personalizeWebsiteContent);

B.

windows,addEventListener('DOMContent Loaded ', personalizeWebsiteContent);

C.

windows,addEventListener('onload', personalizeWebsiteContent);

D.

windows,addEventListener('onDOMCContentLoaded', personalizeWebsiteContent);

A developer has a formatName function that takes two arguments, firstName and lastName and returns a string. They want to schedule the

function to run once after five seconds.

What is the correct syntax toschedule this function?

A.

setTimeout (formatName(), 5000, "John", "BDoe");

B.

setTimeout (formatName('John', ‘'Doe'), 5000);

C.

setTimout(() => { formatName("John', 'Doe') }, 5000);

D.

setTimeout ('formatName', 5000, 'John", "Doe');

Which function should a developer use to repeatedly execute code at a fixed interval ?

A.

setIntervel

B.

setTimeout

C.

setPeriod

D.

setInteria

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

When does Promise.finally on line 08 get called?

A.

When rejected

B.

When resolved and settled

C.

When resolved

D.

When resolved or rejected

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 theserver

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

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

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

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

C.

try{ws.connect (( ) => {console.log(‘connected to client’); });} catch(error) { console.log(‘ERROR’ ,error); };}

A developer has two ways to write a function:

Option A:

function Monster() {

This.growl = () => {

Console.log (“Grr!”);

}

}

Option B:

function Monster() {};

Monster.prototype.growl =() => {

console.log(“Grr!”);

}

After deciding on an option, the developer creates 1000 monster objects.

How many growl methods are created with Option A Option B?

A.

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

B.

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

C.

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

D.

1 growl method is created regardless of whichoption is used.

Given the code below:

Which method can be used to provide a visual representation of the list of users and to allow sorting by the name or email attribute?

A.

console.group(usersList) ;

B.

console.table(usersList) ;

C.

console.info(usersList) ;

D.

console.groupCol lapsed (usersList) ;

Page: 1 / 4
Total 219 questions
Copyright © 2014-2025 Solution2Pass. All Rights Reserved