[Sep-2026] The Best Salesforce Developers JS-Dev-101 Professional Exam Questions
Try 100% Updated JS-Dev-101 Exam Questions [2026]
Salesforce JS-Dev-101 Exam Syllabus Topics:
| Topic | Details |
|---|---|
| Topic 1 |
|
| Topic 2 |
|
| Topic 3 |
|
NEW QUESTION # 60
Refer to the code below:
01 const exec = (item, delay) =>{
02 newPromise(resolve => setTimeout( () => resolve(item), delay)),
03 async function runParallel() {
04 Const (result1, result2, result3) = await Promise.all{
05 [exec ('x', '100') , exec('y', 500), exec('z', '100')]
06 );
07 return `parallel is done: $(result1)$(result2)$(result3)`;
08 }
}
}
Which two statements correctly execute the runParallel () function?
Choose 2 answers
- A. Async runParallel () .then(data);
- B. runParallel ( ). done(function(data){return data;});
- C. runParallel () .then(data);
- D. runParallel () .then(function(data)return data
Answer: B,D
NEW QUESTION # 61
JavaScript:
01 function Tiger() {
02 this.type = 'Cat';
03 this.size = 'large';
04 }
05
06 let tony = new Tiger();
07 tony.roar = () => {
08 console.log('They\'re great!');
09 };
10
11 function Lion() {
12 this.type = 'Cat';
13 this.size = 'large';
14 }
15
16 let leo = new Lion();
17 // Insert code here
18 leo.roar();
Which two statements could be inserted at line 17 to enable line 18?
- A. Object.assign(leo, tony);
- B. Object.assign(leo, Tiger);
- C. leo.prototype.roar = () => { console.log('They\'re pretty good!'); };
- D. leo.roar = () => { console.log('They\'re pretty good!'); };
Answer: A,D
Explanation:
There are two valid ways to ensure leo.roar() exists:
Directly assign a roar function to leo (Option A).
Assigning a property to an instance object creates a new method on that instance.
leo.roar = () => { console.log('They\'re pretty good!'); };
After this, calling leo.roar() is valid.
Copy tony's properties into leo using Object.assign (Option B).
Object.assign(target, source) copies enumerable own properties from the source object into the target object.
Since tony.roar exists, executing:
Object.assign(leo, tony);
copies roar into leo, making leo.roar() valid.
Why the other answers are incorrect:
Option C:
Object.assign(leo, Tiger) copies properties from the function object Tiger, not from Tiger.prototype and not from a Tiger instance. Tiger (the function) has no roar property, so nothing useful is copied.
Option D:
leo.prototype is undefined because leo is an instance, not a constructor function. Only constructor functions have a .prototype property. This line would cause an error.
JavaScript Knowledge Reference (text-only)
Instances have their own properties and do not contain a .prototype property.
Object.assign(target, source) copies own enumerable properties of the source object.
Assigning a function as a property of an object creates a callable method.
NEW QUESTION # 62
A developer has a module that contains multiple functions.
What kind of export should be leveraged so that multiple functions can be used?
- A. default
- B. all
- C. named
- D. multi
Answer: C
Explanation:
The correct answer is D.
When a module contains multiple functions and each function should be available individually, the best choice is a named export.
Example:
function add(a, b) {
return a + b;
}
function subtract(a, b) {
return a - b;
}
export { add, subtract };
Then another file can import exactly the functions it needs:
import { add, subtract } from './mathUtils.js';
console.log(add(5, 2));
console.log(subtract(5, 2));
Named exports are useful when a module provides several reusable functions, constants, or classes.
Why the other options are incorrect:
multi is not a JavaScript export type.
default is usually used when a module has one main value to export. A module can only have one default export.
all is not an export type in JavaScript module syntax.
Therefore, the correct export type for multiple functions is named export, so the verified answer is D.
NEW QUESTION # 63
Which option istrue about the strict mode in imported modules?
- A. Add the statement use non-strict, before any other statements in the module to enablenot-strict mode.
- B. Imported modules are in strict mode whether you declare them as such or not.
- C. Add the statement use strict =false; before any other statements in the module to enablenot- strict mode.
- D. You can only reference notStrict() functions from the imported module.
Answer: B
NEW QUESTION # 64
Refer to code below:
Let productSKU = '8675309' ;
A developer has a requirement to generate SKU numbers that are always 19 characters lon, starting with 'sku', and padded with zeros.
Which statement assigns the values sku0000000008675309 ?
- A. productSKU = productSKU .padEnd (16. '0').padstart('sku');
- B. productSKU = productSKU .padStart (16. '0').padstart(19, 'sku');
- C. productSKU = productSKU .padEnd (16. '0').padstart(19, 'sku');
- D. productSKU = productSKU .padStart (19. '0').padstart('sku');
Answer: B
NEW QUESTION # 65
Refer to the following code block:
class Animal{
constructor(name){
this.name = name;
}
makeSound(){
console.log(`${this.name} ismaking a sound.`)
}
}
class Dog extends Animal{
constructor(name){
super(name)
this.name = name;
}
makeSound(){
console.log(`${this.name} is barking.`)
}
}
let myDog = new Dog('Puppy');
myDog.makeSound();
What is the console output?
Answer:
Explanation:
Puppy is barking
NEW QUESTION # 66
Refer to the code below:
Line 05 causes an error. What are the values of greeting and salutation once code completes?
- A. Greeting is Goodbye and salutation is I say Hello.
- B. Greeting is Goodbye and salutation is Hello, Hello.
- C. Greeting is Hello and salutation is Hello, Hello.
- D. Greeting is Hello and salutation is I say hello.
Answer: C
NEW QUESTION # 67
Which two console logs outputs NaN ?
Choose 2 answers
- A. console.log(10/ ''five);
- B. console.log(10/0);
- C. console.log(parseInt('two'));
- D. console.log(10/ Number('5'));
Answer: A,C
NEW QUESTION # 68
A developer wants to use a try...catch statement to catch any error that countSheep () may throw and pass it to a handleError () function.
What is the correct implementation of the try...catch?
- A.

- B.

Answer: A
NEW QUESTION # 69
Which three options show valid methods for creating a fat arrow function?
Choose 3 answers
- A. x => ( console.log(' executed ') ; )
- B. X,y,z => ( console.log(' executed ') ;)
- C. (x,y,z) => ( console.log(' executed ') ;)
- D. ( ) => ( console.log(' executed ') ;)
- E. [ ] => ( console.log(' executed ') ;)
Answer: A,C
NEW QUESTION # 70
Refer to the following code (correcting the missing template literal backticks):
let codeName = 'Bond';
let sampleText = `The name is ${codeName}, Jim ${codeName}`;
A developer is trying to determine if a certain substring is part of a string.
Which three code statements return true?
- A. sampleText.includes('Jim', 4);
- B. sampleText.substring('Jim');
- C. sampleText.includes('Jim');
- D. sampleText.indexOf('Bond') !== -1;
- E. sampleText.includes('The', 1);
Answer: A,C,D
Explanation:
Comprehensive and Detailed Explanation From Exact Extract JavaScript knowledge:
First, compute sampleText:
let codeName = 'Bond';
let sampleText = `The name is ${codeName}, Jim ${codeName}`;
The template literal evaluates to:
"The name is Bond, Jim Bond"
Now evaluate each statement:
Option A: sampleText.includes('Jim');
String.prototype.includes(substring) returns true if substring occurs anywhere in the string.
sampleText clearly contains "Jim" ("The name is Bond, Jim Bond").
So this returns true.
Option B: sampleText.includes('The', 1);
includes(searchString, position) starts searching from the given position index.
"The name is Bond, Jim Bond" has "The" starting at index 0.
Starting search at index 1 means "The" at index 0 is not considered, and there is no second "The".
So this returns false.
Option C: sampleText.includes('Jim', 4);
"Jim" appears after "The name is Bond, " which is longer than 4 characters; the index of "Jim" is well past 4.
So when searching from index 4, "Jim" is still found.
This returns true.
Option D: sampleText.indexOf('Bond') !== -1;
String.prototype.indexOf(substring) returns:
-1 if the substring is not found,
Otherwise, the starting index of the first occurrence.
"Bond" appears twice in "The name is Bond, Jim Bond".
So sampleText.indexOf('Bond') is some non-negative index (for the first occurrence).
Therefore indexOf('Bond') !== -1 is true.
Option E: sampleText.substring('Jim');
substring expects numeric indexes: substring(startIndex, endIndex?).
If given a string "Jim" as the argument, JavaScript coerces it to a number:
Number('Jim') → NaN
NaN for startIndex is treated as 0.
So sampleText.substring('Jim') is effectively sampleText.substring(0), which returns the full string "The name is Bond, Jim Bond".
This is a string, not a boolean. The question asks "which code statements return true?" This statement returns a string, not the boolean value true.
Thus, the three statements that actually return true (boolean) are:
Study Guide / Concept Reference (no links):
Template literals and ${} interpolation
String.prototype.includes(searchString, position?)
String.prototype.indexOf(substring) and checking for !== -1
String.prototype.substring(start, end?) and argument coercion
Boolean vs non-boolean return types in string methods
________________________________________
NEW QUESTION # 71
Refer to the code declarations below:
Which three expressions return the string JavaScript?
Choose 3 answers
- A. $(str1) $ (str2} ';
- B. Str1.join (str2);
- C. Concat (str1, str2);
- D. Str1.concat (str2);
- E. Str1 + str2;
Answer: A,D,E
NEW QUESTION # 72
Refer to the code declarations below:
let str1 = 'Java';
let str2 = 'Script';
Which three expressions return the string JavaScript?
- A. const({str1, str2});
- B. str1.join(str2);
- C. `${str1}${str2}`
- D. str1 + str2;
- E. str1.concat(str2);
Answer: C,D,E
Explanation:
The correct answers are A, B, and D.
The two variables are:
let str1 = 'Java';
let str2 = 'Script';
The goal is to combine them into:
JavaScript
Option A is correct because template literals can insert variables directly into a string:
`${str1}${str2}`
This becomes:
`${'Java'}${'Script'}`
Result:
JavaScript
Option B is correct because strings have a concat() method:
str1.concat(str2);
This joins str2 onto the end of str1.
Result:
JavaScript
Option D is correct because the + operator performs string concatenation when both operands are strings:
str1 + str2;
This becomes:
'Java' + 'Script'
Result:
JavaScript
The incorrect options:
Option C is not valid JavaScript for joining strings. const is used for declaring constants, not concatenating values.
Option E is incorrect because join() is an array method, not a string method. This would only work with an array, for example:
['Java', 'Script'].join('');
But str1 is a string, so:
str1.join(str2)
is invalid.
Therefore, the verified answers are A, B, and D.
NEW QUESTION # 73
CRefer to the code below:
```javascript
let strNumber = '12345';
```
Which code snippet shows a correct way to convert this string to an integer?
- A. let numberValue = Number(textVelue);
- B. let numberValue = (stunber) textveluer
- C. let numberValue = Integer(strNumber);
- D. let numberValue = textvalue.cornteger();
Answer: A
NEW QUESTION # 74
The developer has a function that prints "Hello" to an input name. To test this,thedeveloper created a function that returns "World". However the following snippet does not print " Hello World".
What can the developer do to change the code to print "Hello World" ?
- A. Change line 9 to sayHello(world) ();
- B. Change line 2 to console.log('Hello' ,name() );
- C. Change line 5 to function world ( ) {
- D. Change line 7 to ) () ;
Answer: B
NEW QUESTION # 75
Given the JavaScript below:
function onLoad() {
console.log("Page has loaded!");
}
Where can the developer see the log statement after loading the page in the browser?
- A. On the webpage console log
- B. On the browser JavaScript console
- C. In the browser performance tools log
- D. On the terminal console running the web server
Answer: B
Explanation:
Comprehensive and Detailed Explanation From Exact Extract JavaScript knowledge:
console.log() in browser-side JavaScript writes output to the browser's JavaScript console, which is available in the browser's Developer Tools.
In a typical browser (Chrome, Firefox, Edge, etc.), you open DevTools and go to the Console tab.
Any console.log("Page has loaded!"); executed in page JavaScript will appear there.
Why A is correct:
The function onLoad is a client-side function (runs in the browser).
When it executes, the console.log call goes to the browser's JavaScript console, not the server.
Why the others are incorrect:
B . On the terminal console running the web server
That console shows logs from the server-side runtime (e.g., Node.js logs).
This code is clearly browser-side JavaScript (no Node.js or server context shown).
Therefore, the output does not appear in the terminal.
C . In the browser performance tools log
Performance tools (Timeline, Performance tab, etc.) show metrics about rendering, CPU time, network, etc., not generic console.log messages.
console.log messages appear in the Console tab, not in performance logs.
D . On the webpage console log
There is no built-in concept of a "webpage console log" UI rendered on the page itself by default.
Unless you explicitly code something to display logs in the DOM, console.log output is not visible on the page, only in Developer Tools.
Therefore, the correct place to see that log is:
JavaScript knowledge / Study Guide references (concept names only, no links):
Browser Developer Tools - Console tab
console.log() in client-side JavaScript
Difference between client-side logs and server-side logs
________________________________________
NEW QUESTION # 76
Which statement accurately describes an aspect of promises?
- A. .then() manipulates and returns the original promise.
- B. In a .then() function, returning results is not necessary since callbacks will catch the result of a previous promise.
- C. Arguments for the callback function passed to .then() are optional.
- D. .then() cannot be added after a catch.
Answer: C
Explanation:
________________________________________
Comprehensive and Detailed Explanation From Exact Extract JavaScript Knowledge Evaluate each option:
________________________________________
A . Arguments for .then() are optional.
This is correct.
.then() has the signature:
promise.then(onFulfilled?, onRejected?)
Both arguments (onFulfilled and onRejected) are optional.
If a callback is not supplied, JavaScript provides a default pass-through handler.
________________________________________
B . .then() cannot be added after a catch.
Incorrect.
Promises support chaining in any order:
promise
.catch(...)
.then(...);
After a catch, the chain continues normally.
________________________________________
C . .then() manipulates and returns the original promise.
Incorrect.
.then() always returns a new promise, not the original one.
This is fundamental to promise chaining behavior.
________________________________________
D . Returning values in .then() is not necessary.
Incorrect.
If you want the next .then() in the chain to receive a value, the current .then() must explicitly return it:
.then(value => {
return value * 2; // passes to next .then()
})
If nothing is returned, the next .then() receives undefined.
________________________________________
Why A is correct
It is the only statement that accurately describes built-in Promise behavior:
.then() accepts optional arguments.
________________________________________
JavaScript Knowledge Reference (text-only)
.then(onFulfilled?, onRejected?) accepts optional handlers.
Promise chaining creates new promises for each .then().
catch() can be followed by additional .then() calls.
Returning inside .then() passes values to the next step in the chain.
NEW QUESTION # 77
Which code statement below correctly persists an objects inlocal Storage ?
- A. const setLocalStorage = ( jsObject) => {window.localStorage.connectObject(jsObject));}
- B. const setLocalStorage = (storageKey, jsObject) => {window.localStorage.setItem(storageKey, JSON.stringify(jsObject));}
- C. const setLocalStorage= ( jsObject) => {window.localStorage.setItem(jsObject);}
- D. const setLocalStorage = (storageKey, jsObject) => {window.localStorage.persist(storageKey, jsObject);}
Answer: B
NEW QUESTION # 78
Refer to the code:
const pi = 3.1415926;
What is the data type of pi?
- A. Decimal
- B. Number
- C. Double
- D. Float
Answer: B
Explanation:
JavaScript has one numeric data type for all real numbers, whether integers or decimals.
This type is simply called:
Number
It follows the IEEE 754 double-precision floating-point standard internally, but JavaScript does not expose separate types like float, double, or decimal.
Therefore:
It is not Float → JavaScript does not have float primitives.
It is not Double → this refers to the underlying IEEE 754 representation, but JavaScript's type is still just "Number." It is not Decimal → JavaScript has no built-in decimal type.
The correct answer is Number.
JavaScript Knowledge Reference (text-only)
JavaScript has a single numeric type: Number.
All numbers-integers, fractions, floating point-use the Number type.
NEW QUESTION # 79
Refer to the following array:
let arr = [1, 2, 3, 4, 5];
Which two lines of code result in a second array, arr2, created such that arr2 is a reference to arr?
- A. let arr2 = arr.slice(0, 5);
- B. let arr2 = arr;
- C. let arr2 = Array.from(arr);
- D. let arr2 = arr.sort();
Answer: B,D
Explanation:
The correct answers are C and D.
Arrays in JavaScript are objects. When an array variable is assigned directly to another variable, both variables point to the same array in memory.
Option C is correct:
let arr2 = arr;
This does not create a new array. It creates another reference to the same array.
Example:
arr2.push(6);
console.log(arr);
Output:
[1, 2, 3, 4, 5, 6]
Changing arr2 also affects arr because both variables reference the same array.
Option D is also correct:
let arr2 = arr.sort();
The sort() method sorts the array in place and returns the same array reference. Therefore, arr2 refers to the same array object as arr.
The incorrect options create copies:
let arr2 = arr.slice(0, 5);
creates a shallow copy.
let arr2 = Array.from(arr);
also creates a new shallow copy.
So the two lines that make arr2 reference the original arr are C and D.
NEW QUESTION # 80
developer uses the code below to format a date.
After executing, what is the value offormattedDate?
- A. June 10, 2020
- B. November 05, 2020
- C. May 10, 2020
- D. October 05, 2020
Answer: A
NEW QUESTION # 81
At Universal Containers, every team has its own way of copyingJavaScript objects. The code snippet shows an Implementation from one team:
What is the output of the code execution?
- A. Hello Dan
- B. SyntaxError: Unexpected token in JSON
- C. Hello John Doe
- D. Hello Dan Doe
Answer: B
NEW QUESTION # 82
A developer wants to create a simple image upload using the File API.
HTML:
<input type="file" onchange="previewFile()">
<img src="" height="200" alt="Image preview..." />
JavaScript:
01 function previewFile() {
02 const preview = document.querySelector('img');
03 const file = document.querySelector('input[type=file]').files[0];
04 // line 4 code
05 reader.addEventListener("load", () => {
06 preview.src = reader.result;
07 }, false);
08 // line 8 code
09 }
Which code in lines 04 and 08 allows the selected local image to be displayed?
- A. 04 const reader = new File();
08 if (file) reader.readAsDataURL(file); - B. 04 const reader = new FileReader();
08 if (file) reader.readAsDataURL(file); - C. 04 const reader = new FileReader();
08 if (file) URL.createObjectURL(file);
Answer: B
Explanation:
The File API in browsers provides the FileReader object to read file contents selected from <input type="file">.
Important knowledge points:
new FileReader() creates a file-reading object.
.readAsDataURL(file) reads a file and produces a Base64 URL string.
The "load" event fires when the file has finished reading.
reader.result contains the data URL after reading completes.
Therefore, the correct implementation must:
Create a FileReader instance:
const reader = new FileReader();
Call:
reader.readAsDataURL(file);
Use the load event handler to assign the image preview:
preview.src = reader.result;
Option B is the only option that matches valid JavaScript File API usage.
Option A is incorrect because File is not a constructor for reading files.
Option C is incorrect because URL.createObjectURL(file) must be assigned directly as a URL, not used with reader.result.
JavaScript Knowledge Reference (text-only)
The file-reading interface in browsers is FileReader.
readAsDataURL() loads files as Base64 data URLs.
The load event indicates when the reader has finished and reader.result is available.
NEW QUESTION # 83
......
JS-Dev-101 Exam Questions Get Updated [2026] with Correct Answers: https://www.exam4tests.com/JS-Dev-101-valid-braindumps.html
Pass JS-Dev-101 Exam - Real Questions and Answers: https://drive.google.com/open?id=1M1n2aBNIiE7yVHL_nJCYqCxIL1u7h0s1