Free JS-101 Practice Test Questions and Answers (2026)

View Mode
Q: 1
Given the following code: Salesforce Javascript Developer I question is the output of line 02?
Options
1 comment in the community discussion
1
Its B. I figure null is its own type, so typeof should return 'null'. Not sure why object would make sense here since null isn't really an object. Anyone recall seeing otherwise?
Q: 2
Which statement phrases successfully?
Options
1 comment in the community discussion
Why do they always use weird quotes in these options? Not seeing any real-world JSON with those, honestly. Is there some trick I'm missing in D or is that just supposed to be double quotes inside single?
Q: 3
Given the code below: const delay = sync delay => { Return new Promise((resolve, reject) => { setTimeout (resolve,delay);});}; const callDelay =async () =>{ const yup =await delay(1000); console.log(1); What is logged to the console?
Options
1 comment in the community discussion
D Is "best" referring to speed or order of async output? Would sequential calls change the answer?
Q: 4
developer is trying to convince management that their team will benefit from using Node.js for a backend server that they are going to create. The server will be a web server that handles API requests from a website that the teamhas already built using HTML, CSS, and JavaScript. Which three benefits of Node.js can the developer use to persuade their manager? Choose 3 answers:
Options
1 comment in the community discussion
D imo, but is the question asking for most important benefits, or literally any three? If stability (option B) was a bigger priority due to strict release cycles, that could maybe change the picks.
Q: 5
Refer to the following code: Salesforce Javascript Developer I question What is the value of output on line 11?
Options
1 comment in the community discussion
D Good question, the output won't be assigned since the code tries to use for...of on myMap.entries without calling it as a function. That's a method, not an iterable by itself, so you'll get a TypeError here. Clear example of how JS iteration works.
Q: 6
A developer creates a class that represents a blog post based on the requirement that a Post should have a body author and view count. The Code shown Below: Class Post{ // Insert code here This.body =body This.author = author; this.viewCount = viewCount; } } Which statement should be inserted in the placeholder on line 02 to allow for a variable to be set to a new instanceof a Post with the three attributes correctly populated?
Options
2 comments in the community discussion
4
Option C, constructor(body, author, viewCount), is correct. That's the valid way to set parameters for a class object in modern JavaScript. B looks like old function syntax and A's a common trap for people coming from inheritance. Let me know if you disagree.
Probably C here, since constructor(body, author, viewCount) is the right way to initialize all three fields in a JS class.
Q: 7
Refer to the code below: Function Person(firstName, lastName, eyecolor) { this.firstName =firstName; this.lastName = lastName; this.eyeColor = eyeColor; } Person.job = ‘Developer’; const myFather = new Person(‘John’, ‘Doe’); console.log(myFather.job); What is the output after the code executes?
Options
2 comments in the community discussion
4
Option A here. The trap is D but the typo in the parameter name (eyecolor vs eyeColor) means ReferenceError is thrown, so myFather doesn't even get created. Seen similar Qs in practice exams.
A tbh, looks like the typo in eyeColor causes a ReferenceError. Can someone confirm if that's right?
Q: 8
Given the JavaScript below: Salesforce Javascript Developer I question Which code should replace the placeholder comment on line 06 to hide accounts that do not match the search string?
Options
1 comment in the community discussion
Probably D here since display should be 'block' when matched, 'none' for non-matches. Just watch out if the list elements are something other than , but for standard lists this fits. Anyone see a case where it wouldn't?
Q: 9
A team that works on a big project uses npm to deal with projects dependencies. A developer added a dependency does not get downloaded when they execute npm install. Which two reasons could be possible explanations for this? Choose 2 answers
Options
1 comment in the community discussion
Probably B and C. If NODE_ENV is production, dev dependencies can be skipped, and missing -save would keep it out of package.json.
Q: 10
Refer to the code snippet: Function getAvailabilityMessage(item) { If (getAvailability(item)){ Var msg =”Username available”; } Return msg; } A developer writes this code to return a message to user attempting to register a new username. If the username is available, variable. What is the return value of msg hen getAvailabilityMessage (“newUserName” ) is executed and getAvailability(“newUserName”) returns false?
Options
2 comments in the community discussion
1
Pretty sure it would be C. Msg hasn't been set so it's not defined, right?
Q: 11
A developer wants to use a module called DataPrettyPrint. This module exports one default functioncalled printDate (). How can a developer import and use the printDate() function? A) Salesforce Javascript Developer I question B) Salesforce Javascript Developer I question C) Salesforce Javascript Developer I question D) Salesforce Javascript Developer I question
Options
1 comment in the community discussion
Option D but does the question specify if printDate should keep its name after import or if any alias is ok? If naming matters, that could change which import syntax is correct.
Q: 12
A developer has a formatName function that takes two arguments, firstName and lastName and returns a string. They want to schedule the function to run once after five seconds. What is the correct syntax toschedule this function?
Options
3 comments in the community discussion
C vs D, but pretty sure it's C. Option C uses an arrow function for proper argument passing, even if the typo's throwing people off. D is just a string reference, which won't execute the function as expected. Anyone see it differently?
C or D? C is right conceptually since setTimeout needs a function reference, not a direct call, even though there are typos in the option. Really clear question compared to others I’ve seen.
Q: 13
Refer the code below. x=3.14; function myfunction() { "use strict"; y=x; } z=x; myFunction();
Your Answer
1 comment in the community discussion
7
Had exactly this question in my exam. z will be 3.14.
Q: 14
Refer to the code below: Const myFunction = arr => { Return arr.reduce((result, current) =>{ Return result = current; }, 10}; } What is the output of this function when called with an empty array ?
Options
2 comments in the community discussion
Not C, D
Q: 15
At Universal Containers, every team has its own way of copyingJavaScript objects. The code snippet shows an Implementation from one team: Salesforce Javascript Developer I question What is the output of the code execution?
Options
1 comment in the community discussion
Its D
Q: 16
Referto the code below: new Promise((resolve, reject) => { const fraction = Math.random(); if( fraction >0.5) reject("fraction > 0.5, " + fraction); resolve(fraction); }) .then(() =>console.log("resolved")) .catch((error) => console.error(error)) .finally(() =>console.log(" when am I called?")); Salesforce Javascript Developer I question When does Promise.finally on line 08 get called?
Options
2 comments in the community discussion
1
D imo. finally() runs when the promise is settled, no matter if it resolves or rejects. Great for cleanup stuff you want to always happen. Don't think it's limited to just resolved or just rejected.
Q: 17
Refer to the string below. Const str=’Salesforce’; Which two statementsresults in the word 'Sales'?
Your Answer
2 comments in the community discussion
6
Totally not sure here, but str.substring(0,5) and str.substr(0,5) I think.
Q: 18
A developer creates a simple webpage with an input field. When a user enters text in the inputfield and clicks the button, the actual value of the field must be displayed in the console. Here is the HTML file content: The developer wrote the javascript codebelow: Const button = document.querySelector(‘button’); button.addEvenListener(‘click’, () => ( Const input = document.querySelector(‘input’); console.log(input.getAttribute(‘value’)); When the user clicks the button, the output is always “Hello”. What needs to be done make this code work as expected?
Options
1 comment in the community discussion
1
A
Q: 19
Given the HTML below: Salesforce Javascript Developer I question Which statement adds the priority-account CSS class to the Universal Containers row?
Options
1 comment in the community discussion
1
Probably B
Q: 20
The developer wants to test the array shown: const arr = Array(5).fill(0) Which two tests are the most accurate for this array ? Choose 2 answers:
Options
2 comments in the community discussion
Not C, A and B. Saw similar question in exam reports, both check exactly what the array should look like.
A and B. Checks length and confirms all values are 0, makes sense for this array.
Question 1 of 20

What's covered in this practice questions set

2: Objects, Functions, and Classes · 6 questions

📖 About this Domain

This domain covers the core building blocks for structuring data and logic in JavaScript. It focuses on creating and manipulating objects, defining reusable logic with functions, and implementing object-oriented patterns using classes. These concepts are fundamental for developing Lightning Web Components.

🎓 What You Will Learn

  • How to create objects using object literals, constructor functions, and the class syntax.
  • The differences between function declarations, function expressions, and arrow functions, including the behavior of the 'this' keyword.
  • How to use ES6 classes to define object blueprints with constructors, methods, getters, and setters.
  • The principles of prototypal inheritance and how objects inherit properties and methods from a prototype chain.

🛠️ Skills You Will Build

  • Ability to model complex data structures using JavaScript objects and their properties.
  • Writing modular, reusable code by encapsulating logic within functions and classes.
  • Implementing object-oriented programming (OOP) concepts like inheritance and encapsulation in a JavaScript context.
  • Debugging scope and context issues related to the 'this' keyword within different function types.

💡 Top Tips to Prepare

  • Master the four binding rules for the 'this' keyword, especially its lexical scoping in arrow functions.
  • Practice creating objects using all three methods (literal, constructor, class) to understand their distinct use cases.
  • Understand how the 'extends' keyword and 'super()' function work for class inheritance, as this mirrors LWC development.
  • Review how to add methods and properties to an object's prototype directly versus within a constructor.

3: Browser and Events · 4 questions

📖 About this Domain

This domain details JavaScript's role within the browser environment, focusing on the Document Object Model (DOM) and event handling. It covers how to programmatically interact with and manipulate web page content. Core topics include the DOM tree, browser events, and the event loop mechanism.

🎓 What You Will Learn

  • You will learn to use the DOM API to query and manipulate HTML elements on a page.
  • You will learn to register event listeners to handle user interactions like clicks and keyboard input.
  • You will learn the mechanics of event propagation, including the capturing and bubbling phases.
  • You will learn about the global Window object and its role in the browser's JavaScript runtime.

🛠️ Skills You Will Build

  • You will build the skill to dynamically modify the DOM by creating, appending, and removing nodes.
  • You will build the skill to implement event listeners and manage the event object to create interactive UIs.
  • You will build the skill to control event flow using methods like `stopPropagation()` and `preventDefault()`.
  • You will build the skill to work with browser APIs and understand the asynchronous nature of the event loop.

💡 Top Tips to Prepare

  • Focus on DOM traversal methods like `querySelector` and properties like `children` and `parentElement`.
  • Master the differences between `event.target` and `event.currentTarget` for precise event handling.
  • Practice the event delegation pattern to efficiently manage events on multiple elements.
  • Study diagrams of the event loop to understand how the call stack and callback queue interact.

4: Debugging and Error Handling · 3 questions

📖 About this Domain

This domain focuses on identifying and resolving errors in client-side JavaScript within the Lightning Experience. It covers the use of browser developer tools and JavaScript language constructs to debug Lightning Web Components and Aura components effectively.

🎓 What You Will Learn

  • Use browser developer tools to set breakpoints, inspect the DOM, and analyze network traffic for component debugging.
  • Leverage the `console` object methods like `console.log()` and `console.error()` for runtime diagnostics in your code.
  • Implement `try...catch` blocks for synchronous error handling and `.catch()` for asynchronous Promise rejections.
  • Apply debugging strategies specific to the LWC and Aura component frameworks, including their lifecycle hooks.

🛠️ Skills You Will Build

  • Troubleshoot JavaScript code to methodically isolate and fix bugs within Lightning components.
  • Write defensive code by implementing structured error handling mechanisms to prevent component failures.
  • Utilize browser profilers to diagnose and resolve client-side performance bottlenecks.
  • Implement effective logging strategies to trace code execution and state changes for easier debugging.

💡 Top Tips to Prepare

  • Master Chrome DevTools; practice stepping through code execution and inspecting component properties.
  • Understand the difference between handling synchronous errors with `try...catch` and asynchronous errors with Promise `.catch()`.
  • Enable Lightning Component Debug Mode in your Salesforce org to access unminified code and more descriptive error stacks.
  • Practice handling and displaying errors returned from Apex controllers within your LWC JavaScript module.

1: Variables, Types, and Collections · 2 questions

📖 About this Domain

This domain covers the fundamentals of data storage and structure in JavaScript. You will demonstrate knowledge of variable declaration, scope, and hoisting. It also assesses your understanding of JavaScript's primitive and reference data types, and collections like Arrays and Maps.

🎓 What You Will Learn

  • How to declare variables using let, const, and var, and describe their scope and hoisting behavior.
  • The characteristics of primitive types versus reference types and how they are stored in memory.
  • Methods to create, access, and iterate over collections like Array, Map, and Set.
  • The process of serializing and deserializing data using JSON.stringify() and JSON.parse().

🛠️ Skills You Will Build

  • Choosing the appropriate variable declaration to manage scope and prevent unintended side effects.
  • Manipulating data collections efficiently using built-in methods like map(), filter(), and forEach().
  • Structuring complex data using objects and arrays for component properties and attributes.
  • Debugging issues related to type coercion and understanding the strict equality operator (===).

💡 Top Tips to Prepare

  • Focus on the differences between let, const, and var, especially regarding block scope and hoisting.
  • Practice common Array methods as they are critical for data manipulation in Lightning Web Components.
  • Understand how pass-by-value for primitives and pass-by-reference for objects impacts function behavior.
  • Memorize JavaScript's truthy and falsy values to accurately predict the flow of conditional statements.

5: Asynchronous Programming · 2 questions

📖 About this Domain

This domain covers JavaScript's single-threaded, non-blocking concurrency model. You will learn how the event loop, callback queue, and microtask queue manage asynchronous operations. Understanding this is critical for building responsive Lightning Web Components that perform server-side calls.

🎓 What You Will Learn

  • Understand the JavaScript event loop and its role in handling asynchronous code execution.
  • Learn to use Promises to manage operations that complete at a future time, including resolve and reject states.
  • Master the async/await syntax for writing cleaner, more readable asynchronous logic.
  • Differentiate between using the wire service and calling Apex imperatively for asynchronous data retrieval in LWC.

🛠️ Skills You Will Build

  • Ability to write non-blocking code that fetches data from Salesforce without freezing the user interface.
  • Skill in chaining multiple asynchronous operations together using Promises and async/await.
  • Competency in implementing robust error handling for asynchronous calls using .catch() and try...catch blocks.
  • Proficiency in managing multiple concurrent asynchronous requests efficiently with methods like Promise.all().

💡 Top Tips to Prepare

  • Practice creating and consuming Promises to fully grasp their lifecycle and chaining with .then().
  • Always wrap await calls within a try...catch block to handle potential promise rejections gracefully.
  • Understand the difference between the microtask queue for Promises and the callback queue to predict execution order.
  • Review how Lightning Data Service and imperative Apex calls return Promises in Lightning Web Components.

7: Testing · 2 questions

📖 About this Domain

This domain covers unit testing for Lightning Web Components using the Jest framework. It emphasizes verifying component rendering, behavior, and event handling in an isolated, off-platform environment. The focus is on ensuring code quality and component reliability through automated tests.

🎓 What You Will Learn

  • You will learn to write Jest test suites to validate the rendered DOM output of a Lightning Web Component.
  • You will learn to test a component's public API, including its properties and methods, by manipulating its state.
  • You will learn how to simulate user interactions, dispatch events, and verify the component's response.
  • You will learn to mock Apex calls and module dependencies to isolate component logic for focused unit tests.

🛠️ Skills You Will Build

  • You will build the skill to configure and run the sfdx-lwc-jest test runner from the command line.
  • You will build the ability to write specific assertions to validate component output and behavior against expected results.
  • You will build proficiency in debugging failed tests by analyzing error messages and component state.
  • You will build the capability to test asynchronous operations and server-side interactions using Jest's mocking features.

💡 Top Tips to Prepare

  • Master the Jest test structure, including describe(), it(), and lifecycle hooks like beforeEach().
  • Practice creating component instances in tests using createElement and appending them to the test's DOM.
  • Understand how to use jest.mock() to handle dependencies on Apex methods wired with @wire or called imperatively.
  • Review the lwc-recipes sample repository for practical examples of Jest tests covering various component scenarios.

6: Server-Side JavaScript · 1 questions

📖 About this Domain

This domain covers JavaScript execution outside the browser, focusing on the Node.js runtime environment. It assesses your knowledge of server-side concepts, modules, and asynchronous programming patterns. You will be tested on core Node.js APIs and the npm ecosystem.

🎓 What You Will Learn

  • Understand the Node.js runtime, including the V8 engine, event loop, and its single-threaded, non-blocking I/O model.
  • Utilize the CommonJS module system with `require()` and `module.exports` to structure server-side applications.
  • Implement asynchronous JavaScript using callbacks, Promises, and async/await for handling operations like file I/O and HTTP requests.
  • Manage project dependencies and run scripts using npm and the `package.json` manifest file.

🛠️ Skills You Will Build

  • Ability to write and debug server-side scripts using core Node.js APIs.
  • Proficiency in managing external packages and project dependencies via the npm CLI.
  • Competency in handling asynchronous control flow for building scalable, non-blocking applications.
  • Skill in creating and consuming modules to build modular and maintainable backend code.

💡 Top Tips to Prepare

  • Focus on the event loop's phases and how it processes the callback queue for asynchronous operations.
  • Practice using core Node.js modules like `fs`, `path`, and `http` to understand their asynchronous nature.
  • Memorize the key properties and scripts within a `package.json` file, such as `dependencies` and `devDependencies`.
  • Distinguish clearly between the CommonJS (`require`) and ES Module (`import`) syntax and their behavior in a Node.js context.

Premium Access Includes

  • Quiz Simulator
  • Exam Mode
  • Progress Tracking
  • Question Saving
  • Flash Cards
  • Drag & Drops
  • 3 Months Access
  • PDF Downloads
Get Premium Access
Scroll to Top

FLASH OFFER

Days
Hours
Minutes
Seconds

avail 10% DISCOUNT on YOUR PURCHASE