Salesforce JS-Dev-101 Practice Exam Questions & Answers

5 Free Questions · Last reviewed: September 13, 2026 · Prepared & Reviewed by the ValidExamDumps Editorial Team

Exam Facts

Salesforce JS-Dev-101 Exam Details

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

147 Practice Questions (Our Bank)
120 minutes Exam Duration
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

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

Correct Answer: B, D
Explanation

Facts about JavaScript Promises:

runParallel() is declared async, which means it always returns a Promise.

Promises are consumed using .then(), .catch(), and .finally().

There is no .done() method in native JavaScript Promises.

The async keyword cannot be placed before a function call (option A is invalid syntax).

Analysis of each option:

A . async runParallel().then(data);

Invalid syntax. async cannot prefix an expression.

B . Valid. Calls the function and attaches a .then() handler.

C . Invalid. .done() is not part of JavaScript Promise API.

D . Valid. Calls runParallel() and chains .then().

Therefore the correct answers are B and D.

JavaScript Knowledge Reference (text-only)

async functions return Promises.

Promises use .then() to retrieve resolved values.

.done() is not part of the standard Promise interface.

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?

Correct Answer: B
Explanation

Comprehensive and Detailed Explanation From JavaScript/Node.js Knowledge:

In a Node.js project that uses package.json, you typically define a 'start' script:

{

'scripts': {

'start': 'node server.js'

}

}

Then you start the app with:

npm start

npm start:

Looks up the 'start' script in package.json.

Runs the command defined there (commonly node server.js).

This is the standard way to start a Node.js app with npm-managed dependencies.

Why others are incorrect:

A . node start

Tries to run a file named start with Node; does not use package.json scripts.

C . npm start server.js

npm start does not take the script filename as an argument in this way; it just runs the start script as defined.

D . start server.js

Not an npm or node command; on some shells it just tries to ''start'' a process but is not the standard Node/npm workflow.

Relevant concepts: package.json, npm scripts, npm start, Node entry file execution.

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?

Correct Answer: B
Explanation

We start with:

let productSKU = '8675309';

The requirement:

Final SKU string:

Length: 19 characters.

Starts with 'sku'.

Remaining characters are digits padded with zeros on the left (to reach total length).

We can use String.prototype.padStart and String.prototype.padEnd:

str.padStart(targetLength, padString)

If str.length < targetLength, it adds padString to the start until the length is targetLength.

str.padEnd(targetLength, padString)

Similar, but adds padString to the end.

We want a pattern like:

First, pad the numeric part out to a fixed length with zeros.

Then, pad to total length with 'sku' at the start.

Analyze Option B

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

Step 1: productSKU.padStart(16, '0')

Initial productSKU is '8675309' (length 7).

After padStart(16, '0'), we pad zeros on the left to reach length 16.

We need 16 7 = 9 zeros:

Result after step 1:

productSKU === '0000000008675309' // length 16

Step 2: .padStart(19, 'sku')

Now productSKU has length 16.

We call padStart(19, 'sku'):

We need 19 16 = 3 extra characters.

The pad string 'sku' is exactly 3 characters, so it is added as-is at the start.

Result after step 2:

productSKU === 'sku0000000008675309' // length 19

This satisfies:

Length 19.

Starts with 'sku'.

Remaining characters are zeros plus the original digits, i.e. a zero-padded numeric section.

While the literal sample sku000000008675309 in the text has a slightly different count of zeros, Option B follows the requirement pattern:

3 characters of 'sku'

Numeric part padded with zeros to make 16 characters total for the numeric part

3 + 16 = 19 total characters

Option B matches the intended logic using padStart and padEnd.

Why the other options are incorrect

Option A:

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

padEnd(16, '0') produces '8675309000000000' (original number followed by zeros).

padStart('sku') is invalid usage:

padStart takes a numeric target length as the first argument, not a string.

Passing 'sku' as the first argument leads to type coercion that does not achieve the intended behavior.

This will not reliably produce the desired SKU.

Option C:

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

First padEnd(16, '0') from '8675309' gives '8675309000000000' (length 16, zeros at the end).

Then padStart(19, 'sku') adds 3 chars 'sku' at the front:

Result: 'sku8675309000000000'.

This string starts with 'sku', but the zeros are at the end of the digits, not padding the numeric part on the left as desired.

Option D:

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

First padStart(19, '0') pads zeros at the left to make the length 19.

Then padStart('sku') again incorrectly uses a string where a numeric targetLength is required.

This will not produce the correct SKU format.

Therefore, the only option that correctly uses padStart to create a 16-character zero-padded numeric portion and then a 19-character string starting with 'sku' is:

Answe r: B

Reference / Study Guide concepts (no links):

String.prototype.padStart(targetLength, padString)

String.prototype.padEnd(targetLength, padString)

String length calculations

Left-padding numeric strings with zeros

Building prefixed identifiers with fixed total length

Value of:

true + 3 + '100' + null

Correct Answer: A
Explanation

The correct answer is A.

JavaScript evaluates the expression from left to right:

true + 3 + '100' + null

Step 1:

true + 3

In numeric addition, true is converted to:

1

So:

true + 3

becomes:

1 + 3

Result:

4

Step 2:

4 + '100'

Because one operand is a string, JavaScript performs string concatenation instead of numeric addition.

So:

4 + '100'

becomes:

'4100'

Step 3:

'4100' + null

Again, because one operand is already a string, JavaScript converts null into the string:

'null'

So the final result is:

'4100null'

Execution summary:

true + 3 + '100' + null

// 1 + 3 + '100' + null

// 4 + '100' + null

// '4100' + null

// '4100null'

Therefore, the verified answer is A.

A developer wants to create a simple image upload using the File API.

HTML:

Image preview...

JavaScript:

01 function previewFile() {

02 const preview = document.querySelector('img');

03 const file = document.querySelector('input[type=file]').files[0];

04 // line 4 code

05 reader.addEventListener("load", () => {

06 preview.src = reader.result;

07 }, false);

08 // line 8 code

09 }

Which code in lines 04 and 08 allows the selected local image to be displayed?

Correct Answer: B
Explanation

The File API in browsers provides the FileReader object to read file contents selected from <input type='file'>.

Important knowledge points:

new FileReader() creates a file-reading object.

.readAsDataURL(file) reads a file and produces a Base64 URL string.

The 'load' event fires when the file has finished reading.

reader.result contains the data URL after reading completes.

Therefore, the correct implementation must:

Create a FileReader instance:

const reader = new FileReader();

Call:

reader.readAsDataURL(file);

Use the load event handler to assign the image preview:

preview.src = reader.result;

Option B is the only option that matches valid JavaScript File API usage.

Option A is incorrect because File is not a constructor for reading files.

Option C is incorrect because URL.createObjectURL(file) must be assigned directly as a URL, not used with reader.result.

JavaScript Knowledge Reference (text-only)

The file-reading interface in browsers is FileReader.

readAsDataURL() loads files as Base64 data URLs.

The load event indicates when the reader has finished and reader.result is available.

Get Full Access

147 questions covering all exam domains, starting from $20

Study Guide

What the Salesforce JS-Dev-101 Exam Covers

Exam domains verified against: Official Salesforce JS-Dev-101 exam guide, last checked September 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 questions from this domain above: Q2Q4Q5

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 question from this domain above: Q3

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 question from this domain above: Q1

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.

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.

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.