Limited-Time Offer: Enjoy 50% Savings! - Ends In 0d 00h 00m 00s Coupon code: 50OFF
Welcome to QA4Exam

Free practice questions with explanations

Salesforce JS-Dev-101 Dumps 2026 with Free Practice Questions and Answers

12 original Salesforce Certified JavaScript Developer exam practice questions with answers and explanations.

Covers Variables, Types, And Collections, Asynchronous Programming, Browser And Events, Objects, Functions, And Classes and 3 more.

Question types: single answer, drag and drop, dropdown, multiple answers and order list. A new question is added every 15 days.

JS-Dev-101 Practice Set Details

Exam Code
JS-Dev-101
Questions On This Page
12
Exam Topics Covered
7 of 7
Question Types
5
Newest Question
New Question
Every 15 days
Full Question Set
147
Certification
Salesforce Developer
12 questions

Salesforce JS-Dev-101 Exam Questions and Answers by Topic

Variables, Types, and Collections

23% of the exam

3 practice questions on this topicWhat this topic covers

Question 1

Added

Multiple Answers

An analytics service receives JSON records with a timestamp string and a list of line items. It must produce a new array containing only records newer than a configured cutoff and with at least one positive-quantity item, while leaving the input response unchanged. The payload can contain missing line-item arrays, and the timestamp strings are ISO 8601 values. Which two implementation choices meet these requirements? (Choose two.)

Correct answer: B, E

Date.parse converts ISO 8601 timestamps to numeric time values that can be compared with a cutoff represented in the same way. filter creates a new array, and lineItems?.some(...) safely handles a missing array while checking for a positive quantity. Sorting mutates the input and does not itself implement both predicates. Mapping to null retains nonqualifying positions and returns the original array when that is what the code returns. Directly calling some fails when lineItems is missing, and lexical comparison is less robust than comparing parsed instants.

Question 2

Added

Dropdown

A browser client receives a JSON response whose records may contain a numeric amount as a string, a missing optional label, or a zero amount. The client must normalize the amount to a number and use a fallback label only when the label is nullish, preserving an empty string as a valid label. Complete the expression with the appropriate operators.

Choose the correct value for each blank.

const amount = Number(record.amount); const label = record.label 'Unlabeled'; const displayAmount = amount 0;
Correct answer:

const amount = Number(record.amount); const label = record.label ?? 'Unlabeled'; const displayAmount = amount ?? 0;

The nullish coalescing operator supplies the fallback only when the label is null or undefined, so an empty string remains a valid label. Applying the same operator to the numeric amount preserves zero rather than replacing it with the fallback. Logical OR would treat both an empty string and zero as falsey and replace them. Logical AND returns a different operand based on truthiness and does not express either fallback requirement.

Question 3

Added

Single Answer

A scheduling interface receives a date-only value such as 2026-03-08 from a business API. The value represents a calendar date, not an instant, and must display the same date to users in multiple time zones. A developer currently constructs new Date(value) and formats it locally; users west of UTC see the previous calendar day. The API contract cannot be changed, and adding a date library is not permitted. What is the best approach for this display requirement?

Correct answer: B

A date-only business value has no time zone or instant semantics, so rendering its year, month, and day components directly avoids shifting the calendar date. Constructing a Date from an ISO date-only string is interpreted as UTC, while local formatting can show the prior day in time zones west of UTC. Adjusting by the current offset is fragile across daylight-saving transitions and does not define the date's semantics. Appending Z still creates a UTC instant and local formatting can still shift it; adding a day based on offset is not generally correct.

Objects, Functions, and Classes

25% of the exam

2 practice questions on this topicWhat this topic covers

Question 4

Added

Order List

A team is introducing a reusable ES module for a money formatter. It must keep one internal currency setting, expose a function that formats amounts, and be consumed by a separate browser module. The module should not add a global variable, and the consumer should use the named export rather than a default export. Arrange the implementation and integration steps in the order they should be performed.

Drag the steps into the correct order, or use the arrows.

  1. Export the formatter by name.
  2. Import the named formatter in the consumer module.
  3. Define the formatting function using the setting.
  4. Declare the currency setting at module scope.
Correct answer:
  1. Declare the currency setting at module scope.
  2. Define the formatting function using the setting.
  3. Export the formatter by name.
  4. Import the named formatter in the consumer module.

The setting must exist before the formatter uses it, and the function must be defined before it can be exported as a named binding. The consumer then imports that exported name from the module. ES module bindings remain module-scoped rather than becoming properties on the global object. Importing before a named export exists would fail module linking, and exporting a default value would not satisfy the consumer's named-import requirement.

Question 5

Added

Single Answer

A logistics application represents delivery windows with a class. Each instance needs its own mutable list of checkpoint events, while all instances should share the same method that formats a delivery summary. A developer placed the list directly on the class as a static property, and updates from one delivery now appear in another. The team wants a minimal change that preserves the current class-based API and does not create a new list on every method call. What should the developer do?

Correct answer: B

An instance field initialized in the constructor gives each delivery its own mutable array. A normal class method is placed on the prototype and shared across instances, which meets the method-sharing requirement. Keeping the array static still shares it unless copied, and copying only during formatting does not isolate updates. A module-level array is shared by all instances as well. A static summary method cannot naturally operate on each instance's state, and initializing state during formatting is too late.

Browser and Events

17% of the exam

2 practice questions on this topicWhat this topic covers

Question 6

Added

Single Answer

A support console renders many case rows, each containing a button to open the case. Rows are inserted and replaced as filters change, so attaching a handler to every button after each render has caused duplicate listeners and missed newly inserted buttons. The team wants one listener, must identify the clicked case, and cannot alter the server-generated row markup beyond its existing data-case-id attribute. What should the developer implement?

Correct answer: D

A listener on the stable table body uses event bubbling to handle both current and future buttons. closest finds the matching button even when the actual target is an icon or span inside it, and the button's data-case-id identifies the case. On a document listener, currentTarget is the document rather than the clicked button. Initial per-button listeners miss later replacements and can be duplicated during rerendering. Assuming the target's immediate parent is the row is brittle and fails when nested markup changes.

Question 7

Added

Single Answer

A user selects a large local CSV for an import preview. The page must display a thumbnail-like preview of the file contents without uploading it, and the preview must work for files selected through an HTML file input. The application cannot depend on a server round trip or a third-party library. Which browser API is the best fit for reading the selected file asynchronously?

Correct answer: D

FileReader.readAsText reads a File selected by the user without uploading it, and its load event exposes the resulting text for parsing and preview. createObjectURL creates a URL referencing the file, not its text; it is useful for consumers such as image or media elements. fetch(file.name) requests a URL and does not read the selected local File by its name. Cookies store string data and cannot hold a File object.

Debugging and Error Handling

7% of the exam

1 practice question on this topicWhat this topic covers

Question 8

Added

Single Answer

A Node.js service processes uploaded records one at a time. A malformed record should be logged with its record ID and skipped, while a database outage should stop the batch and reach the caller's error handler. The current function wraps the entire loop in one try/catch, so malformed input aborts all remaining records. The database API is asynchronous and rejects on failure. What is the best restructuring?

Correct answer: C

A narrow per-record catch lets the service log and skip malformed input without hiding failures from the asynchronous database operation. Database rejections should propagate to an outer handler or caller that can fail the batch appropriately. Catching everything inside the loop would continue after a database outage and could produce incomplete results. Removing error handling leaves a rejection unhandled. Resolving every error conceals failures and incorrectly reports successful completion.

Asynchronous Programming

13% of the exam

2 practice questions on this topicWhat this topic covers

Question 9

Added

Single Answer

A storefront loads a product record and its inventory status from separate endpoints. The product request is required to render the page, but inventory is an optional badge. Both requests should start immediately, and an inventory failure must not prevent the product from appearing. The existing code awaits both requests with Promise.all, so a rejected inventory request currently sends the whole operation to the error path. The endpoints return JSON, and the team wants to preserve ordinary error handling for a failed product request without adding nested callbacks. What is the best change?

Correct answer: B

Starting both requests independently preserves concurrency, while awaiting the product request keeps its failure on the main error path. The inventory promise can have its own catch and update the optional badge only when it succeeds. Promise.allSettled would require inspecting both outcomes and could obscure the required-product failure path. Promise.race returns whichever request settles first, not both results. Delaying inventory until after product success adds latency and does not make a combined Promise.all tolerate inventory rejection.

Question 10

Added

Single Answer

A page schedules a promise callback, a zero-delay timer, and a synchronous update. The product owner reports that the audit message is always written before the timer callback, even on a quiet client, and asks the developer to confirm the intended ordering. The code uses a resolved promise and setTimeout with a delay of 0; neither callback performs additional asynchronous work. Which execution order is guaranteed by JavaScript in a browser after the current script finishes?

Correct answer: B

The current JavaScript task runs to completion first, so the synchronous update occurs before either callback. Promise reactions are queued as microtasks and are processed before the event loop takes the next timer task, so the promise callback precedes the zero-delay timer callback. A zero delay does not make a timer synchronous. The other sequences incorrectly place a deferred callback before the current task finishes or put the timer ahead of the promise reaction.

Server Side JavaScript

8% of the exam

1 practice question on this topicWhat this topic covers

Question 11

Added

Drag And Drop

A Node.js team is selecting built-in modules for a small command-line utility. It must read a configuration file from disk, create a compressed archive stream, and resolve a path independent of the operating system's path separator. The team has ruled out installing packages to keep the deployment footprint small. Match each requirement to the appropriate Node.js core module.

Drag each item onto its matching target. On a phone: tap an item, then tap a target.

Join path segments using platform rules
Create a gzip transform stream
Read a UTF-8 configuration file asynchronously
node:path
node:fs/promises
node:zlib
Correct answer:
  • Read a UTF-8 configuration file asynchronously → node:fs/promises
  • Create a gzip transform stream → node:zlib
  • Join path segments using platform rules → node:path

The fs/promises module provides promise-based filesystem operations, including reading a file with an encoding. The zlib module supplies compression transforms such as gzip streams. The path module implements platform-aware path joining and normalization. Using path for file contents confuses path manipulation with filesystem access. The filesystem module does not provide gzip compression, and zlib does not resolve operating-system-specific paths.

Testing

7% of the exam

1 practice question on this topicWhat this topic covers

Question 12

Added

Single Answer

A browser application's unit test calls a function that schedules a callback with setTimeout. The test invokes the function and immediately checks the callback's result, so it passes locally only when an unrelated delay happens to occur before the assertion. The team uses a test runner that supports asynchronous tests and wants to verify the observable result without adding arbitrary sleeps. What is the best test change?

Correct answer: D

The assertion must wait for the observable asynchronous operation, and a promise resolved by the callback gives the test runner a reliable completion signal. Arbitrarily increasing the production delay changes application behavior without fixing synchronization. A second zero-delay timer is still scheduling-dependent and does not communicate completion to the test runner. Making all mocked timers run synchronously can conceal ordering bugs and does not verify the real asynchronous contract.

More Salesforce Practice Questions

Get the Full Salesforce JS-Dev-101 Dumps as PDF and Practice Test

12 questions are free on this page and the full set has 147. It comes as a PDF and an online practice test, with 90 days of free updates.