- 147 Actual Exam Questions
- Compatible with all Devices
- Printable Format
- No Download Limits
- 90 Days Free Updates
Get All Salesforce Certified JavaScript Developer Exam Questions with Validated Answers
| Vendor: | Salesforce |
|---|---|
| Exam Code: | JS-Dev-101 |
| Exam Name: | Salesforce Certified JavaScript Developer |
| Exam Questions: | 147 |
| Last Updated: | July 9, 2026 |
| Related Certifications: | Salesforce Developer |
| Exam Tags: | Professional Salesforce DevelopersJavaScript ProgrammerFront End Developer |
Looking for a hassle-free way to pass the Salesforce Certified JavaScript Developer exam? DumpsProvider provides the most reliable Dumps Questions and Answers, designed by Salesforce certified experts to help you succeed in record time. Available in both PDF and Online Practice Test formats, our study materials cover every major exam topic, making it possible for you to pass potentially within just one day!
DumpsProvider is a leading provider of high-quality exam dumps, trusted by professionals worldwide. Our Salesforce JS-Dev-101 exam questions give you the knowledge and confidence needed to succeed on the first attempt.
Train with our Salesforce JS-Dev-101 exam practice tests, which simulate the actual exam environment. This real-test experience helps you get familiar with the format and timing of the exam, ensuring you're 100% prepared for exam day.
Your success is our commitment! That's why DumpsProvider offers a 100% money-back guarantee. If you don’t pass the Salesforce JS-Dev-101 exam, we’ll refund your payment within 24 hours no questions asked.
Don’t waste time with unreliable exam prep resources. Get started with DumpsProvider’s Salesforce JS-Dev-101 exam dumps today and achieve your certification effortlessly!
Refer to the code below:
01 const objBook = {
02 title: 'JavaScript',
03 };
04 Object.preventExtensions(objBook);
05 const newObjBook = objBook;
06 newObjBook.author = 'Robert';
What are the values of objBook and newObjBook respectively?
Object.preventExtensions(obj)
This built-in JavaScript method marks an object so that no new properties can be added to it.
Existing properties can still be read and updated, but adding new ones is disallowed.
const newObjBook = objBook;
Both variables reference the same object in memory. JavaScript objects are assigned by reference, not copied.
newObjBook.author = 'Robert';
Because the object has been marked as non-extensible, JavaScript will not allow new properties to be added.
The behavior depends on mode:
In non-strict mode: the assignment silently fails and does nothing.
In strict mode: this would throw a TypeError.
Since nothing indicates strict mode, this is non-strict behavior, making the assignment fail silently.
Therefore, the object remains:
{ title: 'JavaScript' }
Both objBook and newObjBook point to the same unchanged object.
This matches option A.
JavaScript knowledge references (text-only)
Object.preventExtensions() prevents adding new properties.
Assigning an object to another variable copies the reference, not the object.
Adding a property to a non-extensible object silently fails in non-strict mode.
==================================================
Refer to the code below:
01 function myFunction(reassign) {
02 let x = 1;
03 var y = 1;
04
05 if (reassign) {
06 let x = 2;
07 var y = 2;
08 console.log(x);
09 console.log(y);
10 }
11
12 console.log(x);
13 console.log(y);
14 }
What is displayed when myFunction(true) is called?
This question tests understanding of let (block scope) and var (function scope) in JavaScript.
Initial declarations in the function:
let x = 1; // line 2
var y = 1; // line 3
Here:
x is declared with let, so it is block-scoped to the function body.
y is declared with var, so it is function-scoped to the entire function.
Inside the if (reassign) block (and since reassign is true, we enter it):
if (reassign) {
let x = 2; // line 6
var y = 2; // line 7
console.log(x); // line 8
console.log(y); // line 9
}
Detailed behavior:
let x = 2; on line 6 creates a new block-scoped variable x that exists only inside the if block. It does not change the outer x declared on line 2.
var y = 2; on line 7 declares y with var again, but var is function-scoped. This effectively reassigns the same y defined on line 3 for the entire function. After this line, y is 2 everywhere in the function.
Now, inside the if block:
console.log(x); (line 8) logs the inner block-scoped x, which is 2.
console.log(y); (line 9) logs y, which is the function-scoped y that was set to 2.
So the first two outputs are:
2
2
After the if block, execution continues:
console.log(x); // line 12
console.log(y); // line 13
Outside the if block:
The block-scoped let x = 2; no longer exists; it was only visible inside the if block.
The outer let x = 1; (line 2) is still in scope and has not been changed.
Thus:
console.log(x); (line 12) logs the outer x, which is still 1.
console.log(y); (line 13) logs y which, due to var y = 2; inside the if, is now 2 for the whole function.
Therefore, when myFunction(true) is called, the output in order is:
2 (inner x in if)
2 (function-scoped y after reassignment)
1 (outer x after if)
2 (function-scoped y remains 2)
This corresponds to:
Answer : B (2 2 1 2)
JavaScript knowledge / study guide reference concepts:
let declarations and block scope
var declarations and function scope
Shadowing of variables with let inside a block
Re-declaration and reassignment of var within a function
Execution order of statements and console output
Refer to the code:
01 let car1 = new Promise((_, reject) =>
02 setTimeout(reject, 2000, "Car 1 crashed in"));
03 let car2 = new Promise(resolve =>
04 setTimeout(resolve, 1500, "Car 2 completed"));
05 let car3 = new Promise(resolve =>
06 setTimeout(resolve, 3000, "Car 3 completed"));
07
08 Promise.race([car1, car2, car3])
09 .then(value => {
10 let result = '$(value) the race.';
11 })
12 .catch(err => {
13 console.log("Race is cancelled.", err);
14 });
What is the value of result when Promise.race executes?
Promise.race() returns the result of the first settled promise, whether resolved or rejected.
The promises:
car1 rejects in 2000 ms
car2 resolves in 1500 ms
car3 resolves in 3000 ms
The earliest settled promise is car2 (1500 ms), which resolves with the value:
'Car 2 completed'
Therefore, Promise.race enters the .then() branch with:
value = 'Car 2 completed'
Inside the .then():
let result = '$(value) the race.';
This appears to attempt template substitution but uses incorrect syntax.
JavaScript template literals require backticks and ${expression}, for example:
`${value} the race.`
Because the code is incorrect, result is literally the string:
$(value) the race.
However, the question asks:
''What is the value of result when Promise.race executes?''
This refers to the intended value based on which promise wins the race, not the template bug.
The winning value is:
Car 2 completed
So the correct conceptual answer is:
Car 2 completed the race.
JavaScript Knowledge Reference (text-only)
Promise.race() returns the first settled (resolved or rejected) promise.
The earliest resolve here is car2 (1500 ms).
Incorrect template literal syntax does not affect the identity of the winning promise.
A developer executes:
document.cookie;
document.cookie = 'key=John Smith';
What is the behavior?
document.cookie retrieves the cookie string.
Setting document.cookie = 'key=John Smith' adds or updates only that one cookie.
Important details:
Writing to document.cookie does not overwrite all cookies.
The browser does not require URL encoding, though it is recommended. Non-encoded spaces are allowed and automatically handled.
document.cookies does not exist; the correct property is document.cookie.
Therefore, the correct behavior:
Cookies are read.
A new cookie key=John Smith is set.
Existing cookies remain.
JavaScript Knowledge Reference (text-only)
Writing document.cookie appends or updates cookies, not replaces them.
document.cookie is both getter and setter for cookie strings.
==================================================
Refer to the code below:
01 async function functionUnderTest(isOK) {
02 if (isOK) return 'OK';
03 throw new Error('not OK');
04 }
Which assertion accurately tests the above code?
The function:
async function functionUnderTest(isOK) {
if (isOK) return 'OK';
throw new Error('not OK');
}
Behavior:
If isOK is true:
The function resolves (fulfills the promise) with value 'OK'.
If isOK is false:
The function throws, which in an async function becomes a rejected promise with Error('not OK').
We want an assertion that accurately tests the successful path for isOK === true.
Key points about console.assert:
Signature: console.assert(condition, message?)
If condition is falsy, it logs message as an assertion failure.
If condition is truthy, nothing is logged.
We also must understand await:
await functionUnderTest(true) will resolve to the string 'OK'.
Now evaluate options.
Option A:
console.assert(await functionUnderTest(true), 'OK');
await functionUnderTest(true) 'OK' (truthy).
console.assert('OK', 'OK');
Condition is 'OK' (truthy), so assertion passes.
The message 'OK' is only shown if the condition is falsy, which it is not.
This correctly verifies that the promise resolved (i.e., did not reject). Among the given options, this is the only one that both:
Uses await properly on the async function, and
Associates the message with the expected success 'OK'.
Option B:
console.assert(await (functionUnderTest(true), 'not OK'));
Inside the parentheses, the comma operator (a, b) evaluates a, discards it, and returns b.
So (functionUnderTest(true), 'not OK'):
Calls functionUnderTest(true) (returns a promise, but its result is discarded),
The expression evaluates to the string 'not OK'.
Then await 'not OK' just resolves to 'not OK' immediately (not a promise).
console.assert('not OK');
Condition is 'not OK' (truthy), so the assertion passes regardless of what functionUnderTest actually does.
This does not meaningfully test the function and is misleading.
Option C:
console.assert(functionUnderTest(true), 'OK');
functionUnderTest(true) returns a Promise, not the string 'OK' directly.
A Promise object is always truthy.
So console.assert(promise, 'OK') will pass, even if the promise later rejects.
Also, there is no await, so we are not actually waiting for the async result.
This is not a correct way to assert on an async function's resolved value.
Option D:
console.assert(await functionUnderTest(true), 'not OK');
await functionUnderTest(true) still resolves to 'OK' (truthy).
console.assert('OK', 'not OK'); passes.
However, the message 'not OK' is the opposite of what we expect for the success case and is only used when the condition fails.
This makes the assertion logically inconsistent with the function behavior (it would show 'not OK' if the assertion failed).
Therefore, the only assertion that:
Properly waits on the async function, and
Has expectation text that matches the successful behavior ('OK')
is:
Answe r: A
Study Guide / Concept Reference (no links):
async and await behavior in JavaScript
Promises resolving vs rejecting in async functions
console.assert(condition, message) usage
Truthy and falsy values in JavaScript
Comma operator (a, b) semantics
Security & Privacy
Satisfied Customers
Committed Service
Money Back Guranteed