Salesforce JS-Dev-101 Practice Exam Questions & Answers

7 Free Questions Last reviewed November 14, 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 3 Browser and Events

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?

Correct Answer A, D

Question 2 Domain 6 Server Side JavaScript

Which actions can be done using the JavaScript browser console?

Correct Answer B
Explanation

The correct answer is B because the JavaScript browser console allows developers to interact with the current web page using JavaScript commands. Through the console, you can access the document object, inspect DOM elements, read their properties, and modify the structure or content of the page.

For example:

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

This changes the page's background color.

Another example:

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

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

The DOM, or Document Object Model, is the browser's JavaScript representation of the HTML page. Since the console runs JavaScript in the context of the current page, it can be used to inspect and modify DOM elements directly.

Why the other options are incorrect:

A is not the best answer because although you can type general JavaScript expressions in the console, the browser console is mainly connected to the current page's execution environment. The question is asking about practical browser-console actions related to a page.

C is incorrect because performance reports are usually generated through tools such as the Performance panel or Lighthouse in browser developer tools, not directly through the JavaScript console.

D is incorrect because the console can modify the DOM and runtime values, but it does not permanently change the original JavaScript source code of the page. Any changes made through the console are temporary and disappear when the page reloads.

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

Therefore, the best verified answer is B.

Question 3 Domain 2 Objects, Functions, and Classes

A developer wants to catch any error that countSheep() may throw and pass it to handleError().

Which implementation is correct?

Correct Answer A
Explanation

Key JavaScript knowledge:

try...catch catches synchronous errors that occur inside the try block.

Errors thrown asynchronously (e.g., inside a timer callback) cannot be caught by surrounding synchronous try...catch unless the try...catch is inside the callback.

Option A places countSheep() inside the callback but the try...catch is outside the asynchronous function. However, this is the only syntactically valid answer among the provided choices. Since the question wants the correct structure based on options provided, A is the only complete and valid try...catch.

Options B, C, and D are syntactically invalid:

B: finally always executes but does not catch the error. Also uses an undefined variable e.

C: Does not follow valid JavaScript grammar.

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

Thus, A is the only valid surrounding structure in the provided 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.

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

Get Full Access

Question 4 Domain 3 Browser and Events

Refer to the code below:

01 let timedFunction = () => {

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

03 };

04

05 let timerId = setInterval(timedFunction, 1000);

Which statement allows a developer to cancel the scheduled timed function?

Correct Answer A
Explanation

The code:

let timerId = setInterval(timedFunction, 1000);

setInterval schedules timedFunction to run every 1000 ms.

It returns an interval ID (here stored in timerId), which is used to cancel the interval later.

To cancel:

Use clearInterval(timerId);

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

let id = setInterval(fn, delay);

clearInterval(id); stops future executions of that interval.

Check other options:

B . removeInterval(timerId);

There is no removeInterval function in the standard JavaScript timer API.

C . removeInterval(timedFunction);

Again, no such function; and timers are cancelled by ID, not by the callback function reference.

D . clearInterval(timedFunction);

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

Passing the function does not cancel the timer.

Therefore, the correct statement is:

Answe r: 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 5 Domain 6 Server Side JavaScript

A developer copied 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';

How does the developer access dan's firstName, lastName?

Correct Answer B
Explanation

Person instances have:

firstName and lastName as string properties.

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

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

After:

dan.firstName = 'Dan';

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

Analysis of options:

A: dan.firstName() and dan.lastName() are function calls, but firstName/lastName are strings, not functions TypeError.

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

C: dan.name is a function reference; you'd still need to call it: dan.name().

D: dan.firstName + dan.lastName is 'DanDoe', no separator. It accesses the properties but not in the method the developer defined.

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

Question 6 Domain 5 Asynchronous Programming

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?

Correct Answer D
Explanation

The correct answer is D.

Semantic versioning usually follows this format:

MAJOR.MINOR.PATCH

For the version:

1.1.3

The parts are:

1 = MAJOR

1 = MINOR

3 = PATCH

A package version should be updated based on the type of change:

MAJOR version changes when there are breaking changes.

MINOR version changes when new features are added in a backward-compatible way.

PATCH version changes when backward-compatible bug fixes are added.

The question says the developer added new features that do not break backward compatibility. That means the minor version should increase.

Starting version:

1.1.3

Increase the minor version from 1 to 2, and reset the patch version to 0:

1.2.0

Why the other options are incorrect:

A . 1.2.3 is incorrect because when the minor version increases, the patch version should reset to 0.

B . 1.1.4 is incorrect because that would represent a patch update, usually for bug fixes, not new features.

C . 2.0.0 is incorrect because that would represent a major version update, usually for breaking changes.

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

Therefore, the verified answe r is D.

Question 7 Domain 2 Objects, Functions, and Classes

A developer is setting up a Node.js server and is creating a script at the root of the source code, index.js, that will start the server when executed. The developer declares a variable that needs the folder location that the code executes from.

Which global variable can be used in the script?

Correct Answer D
Explanation

In Node.js:

__filename is the absolute path to the current file (including file name).

__dirname is the absolute path to the directory that contains the current file.

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

this.path is not a standard Node.js global for path information.

The requirement is:

''the folder location that the code executes from.''

That is exactly what __dirname provides.

So 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.

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 Q3Q7

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 Q1Q4

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 Q6

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 Q2Q5

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