Salesforce JS-Dev-101 Practice Exam Questions & Answers

8 Free Questions Last reviewed November 17, 2026 Prepared & Reviewed by the ValidExamDumps Editorial Team

147 Practice Questions (Our Bank)
120 minutes Exam Duration
Exam Facts

Salesforce JS-Dev-101 Exam Details

Key details for this exam, checked against the published exam outline

Exam Code
JS-Dev-101
Full Name
Salesforce Certified JavaScript Developer
Issuing Body
Salesforce
Question Format (Our Bank)
Multiple Choice
Practice Questions

Free JS-Dev-101 Practice Questions

Each question shows the correct answer and an explanation of why it is right

VA
ValidExamDumps Editorial Team Every question and its answer is checked by our JS-Dev-101 exam preparation team, who also write the explanation shown with each one. How we research and review these pages

Question 1 Domain 1 Variables, Types, and Collections

A developer needs to determine whether a given value is NaN. Which three of the following approaches can be used to perform this check?

Correct Answer C, D, E
Explanation

JavaScript gives NaN some unusual characteristics:

NaN does not equal any value, itself included.

Equality operators (==, ===) cannot be relied on to identify NaN.

Evaluating each option:

A . value === Number.NaN

Number.NaN is simply NaN.

However, NaN === NaN always evaluates to false.

As a result, this expression never returns true and is not a valid NaN check.

B . value == NaN

The problem is the same here. NaN == NaN always evaluates to false.

Therefore, this option also never detects NaN.

C . Object.is(value, NaN)

Object.is is a stricter method for comparing equality.

It considers NaN equal to NaN, so Object.is(NaN, NaN) returns true.

Consequently, Object.is(value, NaN) is a valid way to detect NaN.

D . value !== value

Since NaN is the only JavaScript value that is not equal to itself,

value !== value evaluates to true only when value is NaN.

This is a well-known technique for detecting NaN.

E . Number.isNaN(value)

Number.isNaN is the modern, recommended way to test whether a value is NaN without type coercion.

It returns true only when value is actually the number NaN.

So, the three valid approaches are:

Object.is(value, NaN)

value !== value

Number.isNaN(value)

Question 2 Domain 3 Browser and Events

A developer has written a fizzbuzz function that takes a number as input and produces the following results:

'fizz' when the number can be divided evenly by 3.

'buzz' when the number can be divided evenly by 5.

'fizzbuzz' when the number can be divided evenly by both 3 and 5.

An empty string '' when the number can be divided evenly by neither 3 nor 5.

Which two test cases correctly check scenarios for the fizzbuzz function?

Correct Answer A, D

Question 3 Domain 6 Server Side JavaScript

What tasks can be carried out by using the JavaScript browser console?

Correct Answer B
Explanation

B is the right choice because the JavaScript browser console lets developers work with the active web page by running JavaScript commands. From the console, you can reach the document object, examine DOM elements, read their properties, and change the structure or content of the page.

Here is an example:

document.body.style.backgroundColor = 'lightblue';

This alters the page's background color.

Here is another:

document.querySelector('h1').textContent = 'Updated Heading';

This updates the text of the first <h1> element on the page.

The DOM, short for Document Object Model, is the browser's JavaScript representation of the HTML page. Because the console runs JavaScript within the context of the current page, it can directly inspect and modify DOM elements.

Reasons the other options are wrong:

A is not the best answer because, although general JavaScript expressions can be typed into the console, the console is mainly tied to the execution environment of the current page. The question focuses on practical console actions related to a page.

C is wrong because performance reports are normally produced with tools such as the Performance panel or Lighthouse in browser developer tools, not directly through the JavaScript console.

D is wrong because the console can change the DOM and runtime values but cannot permanently modify the page's original JavaScript source code. Changes made through the console are temporary and are lost when the page reloads.

E is wrong because security-protected cookies, such as HttpOnly cookies, cannot be viewed or changed using JavaScript. This is a deliberate browser security feature that prevents client-side scripts from accessing sensitive cookie data.

Therefore, the verified answer is B.

Get the complete JS-Dev-101 question set $20$40

Get Full Access

Question 4 Domain 2 Objects, Functions, and Classes

A developer needs to intercept any exception thrown by countSheep() and forward it to handleError().

Which code is the valid choice?

Correct Answer A
Explanation

Core JavaScript concept:

A try...catch block only intercepts synchronous exceptions raised within its try block.

Exceptions raised asynchronously (for example, inside a timer callback) cannot be intercepted by an enclosing synchronous try...catch unless the try...catch sits inside the callback.

Option A positions countSheep() inside the callback, yet the try...catch wraps the asynchronous function from outside. Still, it is the only syntactically valid choice among the listed options. Because the question asks for the correct structure based on the given options, A is the sole complete and valid try...catch.

Options B, C, and D are syntactically invalid:

B: finally always runs but does not intercept the error. It also references an undefined variable e.

C: It does not follow valid JavaScript grammar.

D: The supplied option is incomplete and cannot be correct.

Therefore, A is the only valid enclosing structure among the given choices.

JavaScript Knowledge Reference (text-only)

try...catch syntax must be correctly structured.

finally does not catch errors.

try { } catch (e) { } is valid only when complete and correctly ordered.

Question 5 Domain 3 Browser and Events

Examine the snippet below:

01 let timedFunction = () => {

02 console.log('Timer called.');

03 };

04

05 let timerId = setInterval(timedFunction, 1000);

Which statement can a developer use to stop the timed function that has been scheduled?

Correct Answer A
Explanation

The line:

let timerId = setInterval(timedFunction, 1000);

setInterval schedules timedFunction to execute every 1000 ms.

It hands back an interval ID (in this case saved in timerId), and that ID is what is needed to stop the interval afterward.

To stop it:

Call clearInterval(timerId);

This matches the standard browser (and Node.js) timer API:

let id = setInterval(fn, delay);

clearInterval(id); prevents any further runs of that interval.

Reviewing the other options:

B . removeInterval(timerId);

The standard JavaScript timer API has no removeInterval function.

C . removeInterval(timedFunction);

Once more, this function does not exist, and timers are stopped using their ID rather than the callback function reference.

D . clearInterval(timedFunction);

clearInterval requires the ID returned by setInterval, not the callback function.

Supplying the function does not stop the timer.

So the correct statement is:

Answer: A

Study Guide / Concept Reference (no links):

Timer APIs: setInterval and clearInterval

Relationship between timer ID and cancellation

Difference between interval ID and callback function

Basic async timing patterns in JavaScript

Question 6 Domain 6 Server Side JavaScript

A developer made a copy of a JavaScript object:

01 function Person() {

02 this.firstName = "John";

03 this.lastName = "Doe";

04 this.name = () => `${this.firstName},${this.lastName}`;

05 }

06

07 const john = new Person();

08 const dan = Object.assign({}, john);

09 dan.firstName = 'Dan';

Which approach should the developer use to retrieve dan's firstName, lastName?

Correct Answer B
Explanation

Person instances contain the following:

firstName and lastName are string properties.

A name method returns a combined string: `${this.firstName},${this.lastName}`.

Object.assign({}, john) creates a shallow copy of john in a new object named dan.

After the following assignment:

dan.firstName = 'Dan';

dan.name() returns 'Dan,Doe'.

Review of the options:

A: dan.firstName() and dan.lastName() call values as functions, but firstName and lastName are strings, not functions, which causes a TypeError.

B: Calls the defined method and correctly uses both names.

C: dan.name is only a reference to the function; it must still be invoked as dan.name().

D: dan.firstName + dan.lastName evaluates to 'DanDoe' with no separator. It reads the properties but does not use the method the developer defined.

The intended way, using the provided API, is dan.name().

Question 7 Domain 5 Asynchronous Programming

A developer releases an updated version of a package that adds new features without breaking backward compatibility. The earlier version was 1.1.3.

Under semantic versioning conventions, what version number should the new package carry?

Correct Answer D
Explanation

The correct answer is D.

Semantic versioning typically uses this structure:

MAJOR.MINOR.PATCH

For the version:

1.1.3

The components are:

1 = MAJOR

1 = MINOR

3 = PATCH

The version should be incremented according to the kind of change made:

A MAJOR increment applies when breaking changes are introduced.

A MINOR increment applies when new features are added in a backward-compatible manner.

A PATCH increment applies when backward-compatible bug fixes are included.

The scenario describes new features that keep backward compatibility, so the minor version must go up.

Starting version:

1.1.3

Raise the minor version from 1 to 2 and set the patch version back to 0:

1.2.0

Reasons the other options are wrong:

A . 1.2.3 is wrong because when the minor version rises, the patch version must reset to 0.

B . 1.1.4 is wrong because that would be a patch release, typically for bug fixes rather than new features.

C . 2.0.0 is wrong because that would be a major release, typically for breaking changes.

D . 1.2.0 is correct because it marks a backward-compatible feature release.

Therefore, the verified answer is D.

Question 8 Domain 2 Objects, Functions, and Classes

While configuring a Node.js server, a developer writes a script named index.js in the root directory of the source code, which launches the server when it is run. The script must declare a variable that holds the folder from which the code is executed.

Which global variable is available for use within this script?

Correct Answer D
Explanation

In Node.js:

__filename is the absolute path of the current file, including its file name.

__dirname is the absolute path of the directory that holds the current file.

window.location is a browser-only global and is not available in Node.js.

this.path is not a standard Node.js global that provides path information.

The requirement reads:

''the folder from which the code is executed.''

That is precisely what __dirname supplies.

Therefore the correct choice is __dirname.

Concepts: Node.js globals, __filename, __dirname, Node vs browser environment.

Study Guide

What the Salesforce JS-Dev-101 Exam Covers

Exam domains verified against the Official Salesforce JS-Dev-101 exam guide, last checked November 2026.

Domain 1 Variables, Types, and Collections

23%

Write code to create and initialize variables correctly, working with strings, numbers, and dates. Demonstrate understanding of type coercion effects, truthy and falsey evaluations, array data manipulation, and JSON object operations.

Sample question from this domain above Q1

Domain 2 Objects, Functions, and Classes

25%

Apply object, function, and class implementations to meet business requirements. Understand how to use JavaScript modules and decorators, and analyze variable scope and execution flow within code blocks.

Sample questions from this domain above Q4Q8

Domain 3 Browser and Events

17%

Use events, event handlers, and event propagation to meet business requirements. Evaluate and manipulate the DOM, use browser developer tools to investigate code behavior, and work with browser specific APIs.

Sample questions from this domain above Q2Q5

Domain 4 Debugging and Error Handling

7%

Handle errors properly in code scenarios. Use the browser console and breakpoints to debug code and trace application behavior.

Domain 5 Asynchronous Programming

13%

Apply asynchronous programming concepts including callbacks, promises, and async/await. Understand the event loop and how it controls execution flow and determines outcomes.

Sample question from this domain above Q7

Domain 6 Server Side JavaScript

8%

Infer which Node.js implementation, CLI command, and library or framework fit a given scenario. Distinguish which Node.js package management solution is most appropriate and know the core Node.js modules.

Sample questions from this domain above Q3Q6

Domain 7 Testing

7%

Analyze unit tests alongside code blocks to identify where tests are ineffective. Modify tests to make them more effective at validating code reliability.

FAQ

JS-Dev-101 Exam FAQ

Common questions about the exam itself

What background do I need before taking the JS-Dev-101 exam?
You should have solid experience writing JavaScript code and building applications on the Salesforce platform. The exam covers browser-based JavaScript and Node.js, so familiarity with both client-side and server-side JavaScript is important. Most candidates find the exam challenging if they have not written production code in JavaScript.
How long does it typically take to prepare for JS-Dev-101?
Most candidates spend between 4 and 8 weeks preparing, depending on their existing JavaScript experience. If you are already working with JavaScript daily in Salesforce projects, you might prepare more quickly. If JavaScript is newer to you, allocate more time to practice asynchronous programming and scope concepts.
Which objective area is the hardest part of JS-Dev-101?
Many candidates struggle most with Asynchronous Programming, especially closures, promises, and the event loop. Objects, Functions, and Classes is also challenging because it requires understanding scope and execution flow at a deep level. Practice with real code examples rather than just reading about these topics.
What is the exam format for JS-Dev-101?
The exam contains 60 multiple-choice or multiple-select questions, with up to five additional non-scored questions. You must answer the questions within the time limit and pass with a minimum score determined by Salesforce psychometric analysis.
Can I retake JS-Dev-101 if I fail?
Yes, you can retake the exam. Salesforce allows you to schedule another attempt after your first attempt, though there may be a waiting period between attempts depending on your local policies. Check your exam registration portal for specific retake and rescheduling rules.
How long is the JS-Dev-101 certification valid for?
Salesforce certifications are valid for three years from the date you pass. After that, you must either retake the exam or renew your certification through a renewal path if one is available for your specific certification.
What job role does the JS-Dev-101 certification prepare me for?
This certification is designed for developers who build and maintain JavaScript applications within the Salesforce ecosystem. It qualifies you for roles such as Salesforce JavaScript Developer, Lightning Component Developer, or full-stack Salesforce Developer.
How does JS-Dev-101 relate to other Salesforce developer certifications?
JS-Dev-101 is one of several Salesforce Developer certifications. It focuses on JavaScript and modern web development patterns on the platform. Many developers combine it with Apex-focused certifications like Certified Platform Developer to broaden their skills across multiple Salesforce development languages.
Does JS-Dev-101 cover Lightning components?
The exam covers JavaScript fundamentals and how they apply across the platform, including asynchronous patterns used in Lightning. However, it focuses primarily on core JavaScript concepts rather than Lightning-specific APIs, so you should understand JavaScript first.
What study resources does Salesforce provide for JS-Dev-101?
Salesforce provides study modules through Trailhead Academy, a curated trailmix with interactive content, hands-on projects, and guided learning paths. These resources are designed to help you get exam ready using Salesforce's own materials.

Other Salesforce Exams

Free practice questions for more Salesforce certification exams

All Salesforce exams