OpenExamsFREE PRACTICE — ANY EXAM

Free Salesforce Certified JavaScript Developer Exam Practice Questions

100 free questions · Answer explanations · No signup required

View examination details, outline and sources

Loading selected examination banks…

Sample Practice Questions

Try these 10 sample questions from the Salesforce Certified JavaScript Developer Exam practice bank. Each includes the answer and explanation. Continue with the interactive practice above to review the full question set.

  1. 1What is logged by this JavaScript code? let retries; console.log(retries);

    1. A.null
    2. B.0
    3. C.undefinedCorrect answer: C
    4. D.A ReferenceError is thrown.

    Explanation: MDN states, "If a variable is declared without an initializer, it is assigned the value undefined." The let declaration creates retries and initializes it to undefined, so reading it succeeds; neither null nor zero is supplied.

    Reference: MDN JavaScript Guide: Grammar and types — Declaration and initialization

  2. 2What does this function return when called as scale(6)? function scale(value, factor = 2) { return value * factor; }

    1. A.6
    2. B.12Correct answer: B
    3. C.3
    4. D.8

    Explanation: MDN states, "With default parameters, a manual check in the function body is no longer necessary. You can put 1 as the default value for b in the function head:" Here factor instead defaults to 2. The omitted argument therefore gives 6 × 2 = 12; ignoring the factor gives 6, division gives 3, and addition gives 8.

    Reference: MDN JavaScript Guide: Functions — Default parameters

  3. 3A click on a button bubbles to a listener attached to its parent div. In that listener, which pair identifies the button and the div respectively?

    1. A.event.target and event.currentTargetCorrect answer: A
    2. B.event.currentTarget and event.target
    3. C.event.type and event.target
    4. D.event.currentTarget and event.type

    Explanation: The documentation states, "The difference is that target refers to the element on which the event was initially fired, while currentTarget refers to the element to which this event handler has been attached." The original target is the button; the current listener's element is the div. type is an event name, not an element.

    Reference: MDN Event bubbling — target and currentTarget

  4. 4Code acquires a resource before a try/catch statement. Where should cleanup go so it runs on normal completion, an exception, or an early return from try?

    1. A.Inside the catch block only.
    2. B.Inside the finally block.Correct answer: B
    3. C.Immediately after the entire try/catch statement.
    4. D.At the end of the try block.

    Explanation: MDN states, "the finally block will execute whether or not an exception is thrown." finally also runs when try exits by return. Cleanup only in catch misses success; cleanup after the statement or at the end of try can be bypassed by an early return or abrupt completion.

    Reference: MDN JavaScript Guide: Control flow and error handling — The finally block

  5. 5For const second = first.then(handle), what is second?

    1. A.A new promise representing the handler's completion.Correct answer: A
    2. B.The same promise object as first.
    3. C.The handler's immediate synchronous result.
    4. D.The array of all callbacks on first.

    Explanation: The documentation states, "the then() function returns a new promise, different from the original:" then creates a distinct promise for the continuation; it is not identity-preserving or a synchronous result getter.

    Reference: MDN JavaScript Guide: Using promises — Chaining

  6. 6A Node.js server must read files during request handling while avoiding a synchronous file operation that blocks further JavaScript until completion. Which choice fits?

    1. A.Use readFileSync directly in the request handler.
    2. B.Use asynchronous readFile with a completion callback.Correct answer: B
    3. C.Await the return value of readFileSync in an async handler.
    4. D.Call readFileSync inside a new Promise executor.

    Explanation: Node.js states, "The synchronous APIs block the Node.js event loop and further JavaScript execution until the operation is complete." Choosing the asynchronous file API avoids that blocking. An async wrapper, await applied after the call, or a Promise executor does not make a synchronous filesystem call nonblocking.

    Reference: Node.js File system API — Synchronous example

  7. 7A unit test compares a function's newly created nested result object with the expected property values. Which assertion is designed for recursive strict structural comparison?

    1. A.assert.strictEqual(actual, expected)
    2. B.assert.deepStrictEqual(actual, expected)Correct answer: B
    3. C.assert.ok(actual)
    4. D.assert.notStrictEqual(actual, expected)

    Explanation: The documentation states, ""Deep" equality means that the enumerable "own" properties of child objects are recursively evaluated also by the following rules." deepStrictEqual compares nested structure. Reference equality can reject equivalent new objects, while truthiness or nonidentity does not verify their contents.

    Reference: Node.js Assert API — assert.deepStrictEqual

  8. 8Which declaration produces a syntax error because a required initializer is missing?

    1. A.let maximum;
    2. B.const maximum;Correct answer: B
    3. C.var maximum;
    4. D.const maximum = 12;

    Explanation: MDN states, "const declarations always need an initializer". The const declaration without a value is invalid; var and let allow omitted initializers, and the initialized const is valid.

    Reference: MDN JavaScript Guide: Grammar and types — Declaration and initialization

  9. 9Which declaration collects every argument after prefix into an array named values?

    1. A.Declare values as an ordinary second parameter.
    2. B.Put a rest parameter named prefix before values.
    3. C.Put a rest parameter named values after prefix.Correct answer: C
    4. D.Use an array destructuring pattern for values.

    Explanation: MDN states, "The rest parameter syntax allows us to represent an indefinite number of arguments as an array." Only the rest parameter in the final position collects the remaining arguments; a plain parameter takes one value, and array destructuring does not collect arguments.

    Reference: MDN JavaScript Guide: Functions — Rest parameters

  10. 10A child click handler should run, but this click must not bubble into an ancestor's handler. Which call directly stops that bubbling?

    1. A.event.preventDefault()
    2. B.event.stopPropagation()Correct answer: B
    3. C.event.target.click()
    4. D.event.currentTarget.focus()

    Explanation: The documentation states, "The Event object has a function available on it called stopPropagation() which, when called inside an event handler, prevents the event from bubbling up to any other elements." stopPropagation prevents propagation to ancestors; preventing a default action is a different operation, and click/focus do not stop bubbling.

    Reference: MDN Event bubbling — Fixing the problem with stopPropagation()

Exam Review

About Salesforce Certified JavaScript Developer Exam

Salesforce Certified JavaScript Developer Exam · US

Key exam facts

Provider
Salesforce (examination owner).
Format
Proctored onsite at a testing center or online; multiple-choice/multiple-select; no hard-copy or online references.
Exam questions
Total questions: 60–65; Scored questions: 60; Unscored questions: 0–5; The total includes the scored and unscored questions.
Time limit
105 minutes of examination time.
Passing score
65% passing score.
Exam fee
Initial registration US$200 or JPY 30,000; retake US$100 or JPY 15,000; applicable local taxes are additional.

Topics covered

  • Variables, Types, and Collections (23%)

    • Variable creation and initialization
    • Strings, numbers, and dates
    • Type coercion and its effects
    • Truthy or falsey evaluations
    • Array data manipulation
    • Operating on JSON objects
  • Objects, Functions, and Classes (25%)

    • Function implementation
    • Object implementation
    • Class implementation
    • JavaScript module usage
    • Variable scope and execution flow
  • Browser and Events (17%)

    • Events, event handlers, and propagation
    • DOM evaluation and manipulation
    • Browser Dev Tools investigation
    • Browser specific APIs
  • Debugging and Error Handling (7%)

    • Handling errors
    • Console and breakpoints
  • Asynchronous Programming (13%)

    • Asynchronous programming concepts
    • Event loop, event monitor, and loop outcomes
  • Server Side JavaScript (8%)

    • Node.js implementation
    • Node.js CLI commands
    • Core Node.js modules, libraries, and frameworks
    • Node.Js Package Management
  • Testing (7%)

    • Unit Test effectiveness and improvement

How to prepare

Work through the topics, read the explanation after each answer, and revisit the areas where you miss questions. Use the official outline and reference materials below to guide your study.

These independent practice questions are not actual exam items and do not guarantee a passing result.

Frequently asked questions

What is the exam format?

Proctored onsite at a testing center or online; multiple-choice/multiple-select; no hard-copy or online references.

How many questions are on the exam?

Total questions: 60–65; Scored questions: 60; Unscored questions: 0–5; The total includes the scored and unscored questions.

How long is the exam?

105 minutes of examination time.

What is the passing score?

65% passing score.

How much does the exam cost?

Initial registration US$200 or JPY 30,000; retake US$100 or JPY 15,000; applicable local taxes are additional.

Official sources and references

Confirm current exam arrangements with the exam provider.