Skip to content

JS-Dev-101 Salesforce Certified JavaScript Developer I Practice Questions

Prepare for JS-Dev-101 with more than an answer.

204 questions in the full set17 sample questionsUpdated Mar 12, 2026
Exam fee
$200 USD
Time limit
105 minutes
Passing score
65%
Level
Professional
Valid for
Requires annual maintenance modules on Trailhead
Domains covered on the exam 7
  1. Variables, Types, and Collections23%
  2. Objects, Functions, and Classes25%
  3. Browser and Events17%
  4. Debugging and Error Handling7%
  5. Asynchronous Programming13%
  6. Server Side JavaScript8%
  7. Testing7%
  1. 1

    A developer wants to define a class Manager that extends Employee. Which code snippet correctly implements the constructor of the Manager class?

    Show answer details

    Correct answer: A

    In a derived class, super() must be called before accessing this. This initializes the parent class's constructor.

  2. 2

    Consider the following code:

    const obj = {
    value: 42,
    getValue: function() {
    return this.value;
    }
    };
    
    const retrieve = obj.getValue;
    console.log(retrieve());
    

    What is the result when running this in strict mode, and why?

    Show answer details

    Correct answer: B

    When obj.getValue is assigned to retrieve and called as a standalone function retrieve(), the context (this) is lost. In strict mode, this is undefined in a standalone function call, causing an error when accessing this.value.

  3. 3

    A developer wants to create an object that inherits directly from null to ensure it has no prototype methods like toString or hasOwnProperty.

    Which command achieves this?

    Show answer details

    Correct answer: A

    Object.create(null) creates a new object with its prototype set to null. This is often used for dictionary-like objects where you don't want inherited properties interfering.

  4. 4

    Which of the following statements about Arrow Functions are true? (Select TWO)

    Show answer details

    Correct answer: A, D

    Arrow functions do not provide the arguments object. Rest parameters (...args) should be used instead.

    Arrow functions capture this lexically from the surrounding scope, rather than having their own dynamic this.

  5. 5

    You are implementing a module that needs to export a single main function as the primary export, but also provide a few utility functions.

    Which pattern correctly implements this using ES6 modules?

    Show answer details

    Correct answer: A

    ES6 modules allow one default export and multiple named exports in the same file. This allows consumers to import the main function easily (import main from ...) and destructure utilities if needed (import main, { util } from ...).

  6. 6

    A developer is building a financial dashboard that processes transaction lists. They need to calculate the total balance from an array of transaction objects, where each object contains a type ('credit' or 'debit') and an amount.

    Which array method and implementation best achieves this single-value result?

    Show answer details

    Correct answer: C

    The reduce() method is specifically designed to transform an array into a single value (the accumulator) by applying a function to each element. map() creates a new array of the same length, which is not the goal here.

  7. 7

    A developer encounters a bug where a variable declared inside a for loop is accessible outside the loop, causing unexpected behavior in subsequent logic. The code uses the var keyword.

    Which explanation describes why this is happening?

    Show answer details

    Correct answer: C

    The var keyword creates variables that are function-scoped (or globally scoped if outside a function). They ignore block boundaries like if statements or for loops. To restrict the variable to the loop block, let should be used.

  8. 8

    A developer needs to create a unique list of user IDs from a raw array that contains duplicates. The final result must be an array.

    Which approach provides the most concise and performant solution?

    Show answer details

    Correct answer: A

    The Set object stores only unique values. Passing the array to the Set constructor removes duplicates, and the spread syntax [...] converts it back to an array. This is more concise and generally more performant (O(n)) than using filter with indexOf (O(n^2)).

Create an account to continue.