Last Updated On : 17-Aug-2026
Salesforce Certified JavaScript Developer - JS-Dev-101 Practice Test
Prepare with our free Salesforce Certified JavaScript Developer - JS-Dev-101 sample questions and pass with confidence. Our Salesforce-JavaScript-Developer practice test is designed to help you succeed on exam day.
Salesforce 2026
A 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 team has already built using HTML, CSS, and JavaScript.
Which three benefits of Node.js can the developer use to persuade their manager?
A. Executes server-side JavaScript code to avoid learning a new language.
B. Performs a static analysis on code before execution to look for runtime errors.
C. Uses non-blocking functionality for performant request handling.
D. Ensures stability with one major release every few years.
E. Installs with its own package manager to install and manage third-party libraries.
C. Uses non-blocking functionality for performant request handling.
E. Installs with its own package manager to install and manage third-party libraries.
Explanation:
This question tests your understanding of the key benefits and features of Node.js for back-end development. Node.js allows developers to use JavaScript on the server side, enabling full-stack JavaScript development without learning a new language. It uses a non-blocking, event-driven I/O model, making it highly performant for handling concurrent API requests. Additionally, Node.js comes with npm (Node Package Manager), which is the largest ecosystem of open-source libraries, making it easy to install and manage third-party dependencies. Other options either describe features of other tools (like static analysis in TypeScript) or are not accurate benefits of Node.js.
Correct Options:
A. Executes server-side JavaScript code to avoid learning a new language. –
Correct. Node.js allows developers to use JavaScript on the server side, which means the team can use the same language for both front-end and back-end development. This reduces the learning curve and increases productivity because the team does not need to learn a separate server-side language like Python, Ruby, or Java.
C. Uses non-blocking functionality for performant request handling. –
Correct. Node.js is built on an event-driven, non-blocking I/O model using the libuv library. This allows it to handle many concurrent connections efficiently without blocking the main thread. It is particularly well-suited for I/O-intensive applications like API servers, where requests often wait for database or network responses.
E. Installs with its own package manager to install and manage third-party libraries. –
Correct. Node.js comes bundled with npm (Node Package Manager), which is the largest ecosystem of open-source libraries. npm allows developers to easily install, update, and manage third-party dependencies, making it simple to integrate external libraries and tools into the project.
Incorrect Options:
B. Performs a static analysis on code before execution to look for runtime errors. –
Incorrect. Node.js does not perform static analysis on code before execution. Static analysis is a feature of tools like TypeScript, ESLint, or other linters, not of Node.js itself. Node.js is a runtime environment that executes JavaScript code; it does not analyze code for errors before execution.
D. Ensures stability with one major release every few years. –
Incorrect. Node.js does not follow a "one major release every few years" stability model. It has a rapid release cycle, with new major versions released every six months (in even-numbered years for LTS releases). While Node.js does offer Long-Term Support (LTS) releases, stability is not achieved through infrequent releases.
Reference:
Node.js Official Documentation – Overview and features
Node.js Official Documentation – Non-blocking I/O and event loop
npm Official Documentation – Package manager and ecosystem
Salesforce Trailhead – Node.js Development: Benefits and Use Cases
Which statement accurately describes the behavior of the async/await keywords?
A. The associated function sometimes returns a promise.
B. The associated function can only be called via asynchronous methods
C. The associated class contains some asynchronous functions.
D. The associated function is asynchronous, but acts like synchronous code.
Explanation:
This question tests your understanding of the async/await syntax in JavaScript. The async keyword declares a function that always returns a Promise. The await keyword pauses the execution of the async function until the awaited Promise settles, but it does not block the main thread. This allows asynchronous code to be written in a way that appears synchronous and is easier to read and reason about. The async function itself is asynchronous, but the code inside it using await behaves like synchronous code in terms of control flow, making it more readable than traditional promise chaining.
Correct Option:
D. The associated function is asynchronous, but acts like synchronous code. –
Correct. An async function always returns a Promise, making it asynchronous. However, within the function, the await keyword allows you to write code that appears synchronous (without nested callbacks or .then() chains). The await expression pauses the execution of the async function until the Promise settles, but the rest of the JavaScript runtime continues to execute other tasks. This makes asynchronous code look and behave more like synchronous code from a readability perspective.
Incorrect Options:
A. The associated function sometimes returns a promise. –
Incorrect. An async function always returns a Promise. Even if you return a primitive value, it is automatically wrapped in a resolved Promise. The function does not "sometimes" return a promise; it consistently returns one.
B. The associated function can only be called via asynchronous methods. –
Incorrect. An async function can be called just like any other function, synchronously or asynchronously. You can call an async function from a regular synchronous function, but you will receive a Promise in return. It is not restricted to being called only from other asynchronous methods.
C. The associated class contains some asynchronous functions. –
Incorrect. The async keyword is used on functions, not on classes themselves. A class can contain async methods, but the statement "The associated class contains some asynchronous functions" does not describe the behavior of async/await accurately. It is too vague and does not capture the core purpose of async/await.
Reference:
MDN Web Docs – async function and return value
MDN Web Docs – await operator and control flow
MDN Web Docs – Asynchronous programming with async/await
Salesforce Trailhead – JavaScript Essentials: Asynchronous Programming and async/await
Refer to the code snippet:
01 let array = [1, 2, 3, 4, 4, 5, 4, 4];
02 for (let i = 0; i < array.length; i++) {
03 if (array[i] === 4) {
04 array.splice(i, 1);
05 i--;
06 }
07 }
What is the value of array after the code executes?
A. [1, 2, 3, 4, 5, 4, 4]
B. [1, 2, 3, 4, 4, 5, 4]
C. [1, 2, 3, 4, 5, 4]
D. [1, 2, 3, 5]
Explanation:
This question tests your understanding of array mutation with splice() within a loop and how modifying an array in place affects the loop index. The splice(i, 1) removes the element at index i and shifts all subsequent elements left by one position. The i-- decrement compensates for this shift so that the next iteration checks the element that moved into the current position. The loop removes all occurrences of 4 from the array. The original array is [1, 2, 3, 4, 4, 5, 4, 4]; after removing all four 4s, the remaining elements are [1, 2, 3, 5].
Correct Option:
D. [1, 2, 3, 5] – Correct. Let's trace the execution:
Start with array = [1, 2, 3, 4, 4, 5, 4, 4]
i = 0: array[0] = 1 → no removal
i = 1: array[1] = 2 → no removal
i = 2: array[2] = 3 → no removal
i = 3: array[3] = 4 → remove it, i-- to 2, array becomes [1, 2, 3, 4, 5, 4, 4]
i = 3: array[3] = 4 (the next 4) → remove it, i-- to 2, array becomes [1, 2, 3, 5, 4, 4]
i = 3: array[3] = 5 → no removal
i = 4: array[4] = 4 → remove it, i-- to 3, array becomes [1, 2, 3, 5, 4]
i = 4: array[4] = 4 → remove it, i-- to 3, array becomes [1, 2, 3, 5]
i = 4: array.length = 4, loop ends
Final array: [1, 2, 3, 5].
Incorrect Options:
A. [1, 2, 3, 4, 5, 4, 4] –
Incorrect. This is the array after removing one 4 (the first one at index 3). The loop continues and removes all remaining 4s, so this is not the final state.
B. [1, 2, 3, 4, 4, 5, 4] –
Incorrect. This is the original array with the last 4 removed, but the loop removes all 4s, not just the last one. This option does not reflect the complete removal.
C. [1, 2, 3, 4, 5, 4] –
Incorrect. This would be the result if only some of the 4s were removed. However, the loop continues and removes all occurrences of 4. The final array does not contain any 4s.
Reference:
MDN Web Docs – Array.prototype.splice() method
MDN Web Docs – Mutating arrays in loops
MDN Web Docs – Array length and index management
Salesforce Trailhead – JavaScript Essentials: Arrays and Array Manipulation
Refer to the following object:
const dog = {
firstName: ' Beau ' ,
lastName: ' Boo ' ,
get fullName() {
return this.firstName + ' ' + this.lastName;
}
};
How can a developer access the fullName property for dog?
A. dog.fullName
B. dog.fullName()
C. dog.get.fullName
D. dog.function.fullName()
Explanation:
This question tests your knowledge of getter syntax in JavaScript objects. A getter is defined using the get keyword before a method name. It allows you to define a property that is accessed like a regular property (without parentheses), but internally it executes a function to compute and return a value. In the given code, fullName is defined as a getter, so it must be accessed as dog.fullName, not dog.fullName(). Calling it as a function would throw an error because it is not a method; it is a property with a getter.
Correct Option:
A. dog.fullName –
Correct. Since fullName is defined as a getter using the get keyword, it is accessed as a regular property, not a function. The getter automatically executes the associated function and returns the concatenated string 'Beau Boo'. No parentheses are needed or allowed. This is the standard and correct way to access getter properties in JavaScript.
Incorrect Options:
B. dog.fullName() –
Incorrect. This attempts to invoke fullName as a function. However, fullName is defined as a getter, not a method. When you append parentheses to a getter, JavaScript throws a TypeError stating that dog.fullName is not a function. Getters are accessed as properties, not invoked as methods.
C. dog.get.fullName –
Incorrect. There is no get property on the dog object. The get keyword is used only during the definition of the getter, not as a runtime property. Accessing dog.get would return undefined, and trying to access .fullName on undefined would throw a TypeError.
D. dog.function.fullName() –
Incorrect. There is no function property on the dog object. The function keyword is used only during definition, not as a runtime property. This syntax is invalid and would result in a TypeError because dog.function does not exist. Even if it did, the parentheses would attempt to invoke it incorrectly.
Reference:
MDN Web Docs – getter (get syntax) in object initializers
MDN Web Docs – Working with objects and property accessors
MDN Web Docs – Object.defineProperty() for getters/setters
Salesforce Trailhead – JavaScript Essentials: Objects and Properties
Given the code below:
01 const delay = async delay = > {
02 return new Promise((resolve, reject) = > {
03 console.log(1);
04 setTimeout(resolve, delay);
05 });
06 };
07
08 const callDelay = async () = > {
09 console.log(2);
10 const yup = await delay(1000);
11 console.log(3);
12 };
13
14 console.log(4);
15 callDelay();
16 console.log(5);
What is logged to the console?
A. 4 2 1 5 3
B. 4 2 1 5 3
C. 1 4 2 3 5
D. 4 5 1 2 3
Explanation:
This question tests your understanding of the JavaScript event loop, async/await, setTimeout, and the order of execution of synchronous and asynchronous code. Synchronous code runs first, so console.log(4) and console.log(5) execute immediately. Inside callDelay(), console.log(2) runs synchronously, then await delay(1000) is called. Inside delay, console.log(1) runs synchronously before setTimeout is scheduled. The await pauses callDelay, allowing the main thread to continue, so console.log(5) executes. After 1000ms, setTimeout resolves the promise, and console.log(3) executes. The final order is 4, 2, 1, 5, 3.
Correct Option:
A. 4 2 1 5 3 – Correct. Let's trace the execution step by step:
Line 14: console.log(4) executes synchronously → logs 4.
Line 15: callDelay() is invoked.
Inside callDelay, Line 09: console.log(2) executes synchronously → logs 2.
Line 10: await delay(1000) is called.
Inside delay:
Line 03: console.log(1) executes synchronously → logs 1.
Line 04: setTimeout(resolve, 1000) schedules a timer for 1000ms.
delay returns a pending Promise.
The await on line 10 pauses callDelay, and control returns to the main thread.
Line 16: console.log(5) executes synchronously → logs 5.
After 1000ms, the setTimeout callback resolves the promise, allowing callDelay to resume.
Line 11: console.log(3) executes → logs 3.
Final output: 4 2 1 5 3.
Incorrect Options:
B. 4 2 1 5 3 –
This is the same as option A, which is correct. (Duplicates in the question.)
C. 1 4 2 3 5 –
Incorrect. This suggests that console.log(1) logs before console.log(4), but console.log(4) is synchronous and runs before callDelay() is even called. console.log(1) runs inside callDelay(), which is called after console.log(4). The order is incorrect.
D. 4 5 1 2 3 –
Incorrect. This suggests that console.log(2) logs after console.log(5), but console.log(2) runs synchronously inside callDelay() before console.log(5) is reached. The order is incorrect because console.log(2) executes before the await pauses the function.
Reference:
MDN Web Docs – Event loop and asynchronous execution
MDN Web Docs – async/await and control flow
MDN Web Docs – setTimeout and timers
Salesforce Trailhead – JavaScript Essentials: Asynchronous Programming and Event Loop
| Salesforce-JavaScript-Developer Exam Questions - Home |
| Page 2 out of 30 Pages |