IT Certifications · JS-Dev-101

Salesforce Javascript DEV Exam Practice Test

JavaScript development for Salesforce involves core language behavior alongside Lightning Web Component patterns. The available practice material touches on block-scoped variables, array transformation, asynchronous functions, promise handling, safe property access, and browser events. It also includes LWC-specific concepts such as component properties, localized labels, and component styling.

Exam overview

Exam providerSalesforce
Exam codeJS-Dev-101
CategoryIT Certifications

About the Salesforce Javascript DEV Exam

The question bank brings together decisions developers make when writing and maintaining JavaScript. Language-focused scenarios ask you to distinguish `let` scope, select `filter()` for creating a subset of an array, use optional chaining for nullable nested values, and understand how `await`, `Promise.all()`, and `finally` affect asynchronous control flow and error handling. Browser event questions address whether a custom event bubbles through the DOM. Salesforce-specific examples focus on exposing component data with `@api`, referencing labels for localized text, and applying CSS within an LWC. These concepts matter when building components that communicate predictably, handle incomplete data, and coordinate asynchronous operations. The practice topics are signals from the available question bank, not a verified statement of the exam’s official coverage.

Sample Practice Questions

Review a selection from this exam's published US Practice Tests practice bank.

Question 1

In JavaScript, which statement about `let` and block scope is accurate?

  1. AA `let` binding is limited to the nearest enclosing block
  2. BA `let` binding is always global
  3. CA `let` binding can be redeclared in the same scope without an error
  4. DA `let` binding is accessible before its declaration is initialized
Show answerCorrect answer: A

A `let` declaration is block-scoped, so it is available within its enclosing `{}` block, subject to its initialization rules. It cannot be redeclared in the same scope.

Question 2

A JavaScript function should create a new array containing only values greater than 10 from `numbers`. Which method is intended for this task?

  1. A`numbers.forEach(...)`
  2. B`numbers.filter(...)`
  3. C`numbers.find(...)`
  4. D`numbers.reduce(...)`
Show answerCorrect answer: B

`filter` returns a new array containing every element for which the callback returns a truthy value. `find` returns only the first matching element, while `forEach` does not create a filtered result array.

Question 3

What is the purpose of `@api` on a Lightning Web Component property?

  1. ATo make the property reactive only within the component
  2. BTo expose the property as part of the component's public interface
  3. CTo persist the property automatically in Salesforce records
  4. DTo make the property available only to Apex
Show answerCorrect answer: B

In Lightning Web Components, `@api` marks a public property or method that a parent component can interact with. It does not persist values or grant Apex access.

Question 4

In an `async` function, what happens when execution reaches `await somePromise`?

  1. AThe function pauses until the promise settles, then continues with its result or throws its rejection
  2. BThe entire JavaScript runtime blocks until the promise settles
  3. CThe promise is converted into a callback function
  4. DThe function immediately returns the promise's eventual value as a plain value
Show answerCorrect answer: A

`await` suspends the async function's continuation until the awaited promise settles. It does not block the JavaScript runtime; a rejection is thrown at the await point and can be handled with `try`/`catch`.

Question 5

In an LWC template, how does a component expose a value for localization using Salesforce's label mechanism?

  1. AImport the label from `@salesforce/label` and reference the imported value in the component
  2. BRead the label from `window.labels` at runtime
  3. CPlace the label API name in a CSS custom property
  4. DCall `getLabel()` from the browser's `document` object
Show answerCorrect answer: A

Salesforce custom labels can be imported into an LWC JavaScript module from `@salesforce/label/...` and then referenced by the component. This supports translated, centrally managed text instead of hard-coding user-facing strings.

Question 6

A JavaScript object has an optional nested property. Which syntax safely reads `account.owner.name` when `owner` might be `null` or `undefined`?

  1. A`account.owner?.name`
  2. B`account.owner!.name`
  3. C`account.owner??name`
  4. D`account.owner::name`
Show answerCorrect answer: A

Optional chaining (`?.`) stops property access and yields `undefined` if the value immediately to its left is `null` or `undefined`, avoiding an access error in this case.

Question 7

What does the `bubbles` option control when creating a `CustomEvent` in the browser?

  1. AWhether the event propagates upward through the DOM event path
  2. BWhether the event handler runs asynchronously
  3. CWhether the event can carry a `detail` value
  4. DWhether the event is automatically canceled
Show answerCorrect answer: A

When `bubbles` is `true`, the event propagates from its dispatch target upward through the DOM event path, allowing ancestor listeners to receive it. This option is separate from event payload and cancellation behavior.

How to use this practice test

Access the practice questions for free. Each session presents up to 20 random questions from the available 50-question bank, then shows your results. Use missed items to identify whether you need to revisit JavaScript fundamentals, asynchronous behavior, browser events, or LWC implementation details.

Preparation tips

  • Write small examples with `let` inside nested blocks, then predict which references remain accessible outside each block.
  • Compare `filter()`, `map()`, and `find()` using the same array to distinguish subset creation, transformation, and single-value lookup.
  • Trace fulfilled and rejected promises through `await`, `Promise.all()`, `try...catch`, and `finally`; note which paths continue and which reject.
  • Build an LWC example that exposes a property with `@api`, references a Salesforce label, and uses component-scoped CSS.
  • Test optional chaining and `CustomEvent` options in short examples, checking behavior when nested values are null and when events bubble.
Official sourceOfficial exam page ↗