Salesforce Certified JavaScript Developer (JS-Dev-101)
Last Update Jun 27, 2026
Total Questions : 147
We are offering FREE JavaScript-Developer-I Salesforce exam questions. All you do is to just go and sign up. Give your details, prepare JavaScript-Developer-I free exam questions and then go for complete pool of Salesforce Certified JavaScript Developer (JS-Dev-101) test questions that will help you more.
Given the HTML below:
< div >
< div id= " row-uc " > Universal Containers < /div >
< div id= " row-as " > Applied Shipping < /div >
< div id= " row-bt " > Burlington Textiles < /div >
< /div >
Which statement adds the priority-account CSS class to the Applied Shipping row?
Given the JavaScript below:
01 function filterDOM(searchString){
02 const parsedSearchString = searchString & & searchString.toLowerCase();
03 document.querySelectorAll( ' .account ' ).forEach(account = > {
04 const accountName = account.innerHTML.toLowerCase();
05 account.style.display = accountName.includes(parsedSearchString) ? /* Insert code here */;
06 });
07 }
Which code should replace the placeholder comment on line 05 to hide accounts that do not match the search string?
Given the code below:
01 setTimeout(() = > {
02 console.log(1);
03 }, 1100);
04 console.log(2);
05 new Promise((resolve, reject) = > {
06 setTimeout(() = > {
07 reject(console.log(3));
08 }, 1000);
09 }).catch(() = > {
10 console.log(4);
11 });
12 console.log(5);
What is logged to the console?
HTML:
< p > The current status of an Order: < span id= " status " > In Progress < /span > < /p >
Which JavaScript statement changes ' In Progress ' to ' Completed ' ?
A developer is setting up a new Node.js server with a client library that is built using events and callbacks.
The library:
Will establish a web socket connection and handle receipt of messages to the server.
Will be imported with require, and made available with a variable called ws.
The developer also wants to add error logging if a connection fails.
Given this information, which code segment shows the correct way to set up a client with two events that listen at execution time?
Refer to the code below:
01 function changeValue(param) {
02 param = 5;
03 }
04 let a = 10;
05 let b = a;
06
07 changeValue(b);
08 const result = a + ' - ' + b;
What is the value of result when the code executes?
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?
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?
At Universal Containers, every team has its own way of copying JavaScript objects. The code snippet shows an implementation from one team:
01 function Person() {
02 this.firstName = " John " ;
03 this.lastName = " Doe " ;
04 this.name = () = > {
05 console.log( ' Hello ${this.firstName} ${this.lastName} ' );
06 }
07 }
08
09 const john = new Person();
10 const dan = JSON.parse(JSON.stringify(john)); // (intended deep copy)
11 dan.firstName = ' Dan ' ;
12 dan.name();
(Original line 10 is logically intended to be JSON.parse(JSON.stringify(john)) to perform a JSON clone.)
What is the output of the code execution?
Given the following code:
01 let x = null;
02 console.log(typeof x);
What is the output of line 02?
Refer to the code below:
let inArray = [ [1, 2], [3, 4, 5] ];
Which two statements result in the array [1, 2, 3, 4, 5]?
(With corrected typing errors: usArray → inArray, .. → ....)
Refer to the following code:
01 class Ship {
02 constructor(size) {
03 this.size = size;
04 }
05 }
06
07 class FishingBoat extends Ship {
08 constructor(size, capacity){
09 //Missing code
10 this.capacity = capacity;
11 }
12 displayCapacity() {
13 console.log( ' The boat has a capacity of ${this.capacity} people. ' );
14 }
15 }
16
17 let myBoat = new FishingBoat( ' medium ' , 10);
18 myBoat.displayCapacity();
Which statement should be added to line 09 for the code to display
The boat has a capacity of 10 people?
Refer to the code below:
01 let first = ' Who ' ;
02 let second = ' What ' ;
03 try {
04 try {
05 throw new Error( ' Sad trombone ' );
06 } catch (err) {
07 first = ' Why ' ;
08 throw err;
09 } finally {
10 second = ' When ' ;
11 }
12 } catch (err) {
13 second = ' Where ' ;
14 }
What are the values for first and second once the code executes?
Refer to the code below:
01 < html lang= " en " >
02 < table onclick= " console.log( ' Table log ' ); " >
03 < tr id= " row1 " >
04 < td > Click me! < /td >
05 < /tr >
06 < /table >
07 < script >
08 function printMessage(event) {
09 console.log( ' Row log ' );
10 event.stopPropagation();
11 }
12
13 let elem = document.getElementById( ' row1 ' );
14 elem.addEventListener( ' click ' , printMessage, false);
15 < /script >
16 < /html >
Which code change should be done for the console to log the following when " Click me! " is clicked?
Row log
Table log
Given the code below:
01 setCurrentUrl();
02 console.log( " The current URL is: " + url);
03
04 function setCurrentUrl() {
05 url = window.location.href;
06 }
What happens when the code executes?
Refer to the code below:
01 const myFunction = arr = > {
02 return arr.reduce((result, current) = > {
03 return result + current;
04 }, 10);
05 }
What is the output of this function when called with an empty array?
Refer to the code:
01 function execute() {
02 return new Promise((resolve, reject) = > reject());
03 }
04 let promise = execute();
05
06 promise
07 .then(() = > console.log( ' Resolved1 ' ))
08 .then(() = > console.log( ' Resolved2 ' ))
09 .then(() = > console.log( ' Resolved3 ' ))
10 .catch(() = > console.log( ' Rejected ' ))
11 .then(() = > console.log( ' Resolved4 ' ));
What is the result when the Promise in the execute function is rejected?
A team at Universal Containers works on a big project and uses yarn to manage the project ' s dependencies.
A developer added a dependency to manipulate dates and pushed the updates to the remote repository. The rest of the team complains that the dependency does not get downloaded when they execute yarn .
What could be the reason for this?
Corrected code:
let obj = {
foo: 1,
bar: 2
};
let output = [];
for (let something in obj) {
output.push(something);
}
console.log(output);
What is the output of line 11?
Given the code below:
let numValue = 1982;
Which three code segments result in a correct conversion from number to string?
Refer to the code:
01 console.log( ' Start ' );
02 Promise.resolve( ' Success ' ).then(function(value) {
03 console.log( ' Success ' );
04 });
05 console.log( ' End ' );
What is the output after the code executes successfully?
Refer to the code below:
01 new Promise((resolve, reject) = > {
02 const fraction = Math.random();
03 if (fraction > 0.5) reject( ' fraction > 0.5, ' + fraction);
04 resolve(fraction);
05 })
06 .then(() = > console.log( ' resolved ' ))
07 .catch((error) = > console.error(error))
08 .finally(() = > console.log( ' when am I called? ' ));
When does Promise.finally on line 08 get called?
A developer uses a parsed JSON string to work with user information as in the block below:
01 const userInformation = {
02 " id " : " user-01 " ,
03 " email " : " user01@universalcontainers.demo " ,
04 " age " : 25
05 };
Which two options access the email attribute in the object?
Refer to the code below:
01 let o = {
02 get js() {
03 let city1 = String( ' St. Louis ' );
04 let city2 = String( ' New York ' );
05
06 return {
07 firstCity: city1.toLowerCase(),
08 secondCity: city2.toLowerCase(),
09 }
10 }
11 }
What value can a developer expect when referencing o.js.secondCity?
Refer to the code below:
01 const addBy = ?
02 const addByEight = addBy(8);
03 const sum = addByEight(50);
Which two functions can replace line 01 and return 58 to sum?
A test searches for:
< button class= " blue " > Checkout < /button >
But the actual HTML is:
< button > Checkout < /button >
The test fails because it expects a class that no longer exists.
What type of test outcome is this?
A developer wants to advocate for a mature, well-supported web framework/library instead of a new one (Minimalist.js).
Which two should be recommended?
A developer publishes a new version of a package with new features that do not break backward compatibility. The previous version number was 1.1.3.
Following semantic versioning formats, what should the new package version number be?
After user acceptance testing, the developer is asked to change the webpage background based on the user’s location. It works on the developer’s computer but not on the tester’s machine.
Which two actions will help determine accurate results?
Refer to the following code block (with corrected template literals using backticks):
01 class Animal {
02 constructor(name) {
03 this.name = name;
04 }
05
06 makeSound() {
07 console.log(`${this.name} is making a sound.`);
08 }
09 }
10
11 class Dog extends Animal {
12 constructor(name) {
13 super(name);
14 this.name = name;
15 }
16 makeSound() {
17 console.log(`${this.name} is barking.`);
18 }
19 }
20
21 let myDog = new Dog( ' Puppy ' );
22 myDog.makeSound();
What is the console output?
A developer has an isDeg function that takes one argument, pts. They want to schedule the function to run every minute.
What is the correct syntax for scheduling this function?
Refer to the code:
01 const exec = (item, delay) = >
02 new Promise(resolve = > setTimeout(() = > resolve(item), delay));
03
04 async function runParallel() {
05 const [result1, result2, result3] = await Promise.all(
06 [exec( ' x ' , ' 100 ' ), exec( ' y ' , ' 500 ' ), exec( ' z ' , ' 100 ' )]
07 );
08 return `parallel is done: ${result1}${result2}${result3}`;
09 }
Which two statements correctly execute runParallel()?
Code:
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 execution?
01 function changeValue(obj) {
02 obj.value = obj.value / 2;
03 }
04 const objA = { value: 10 };
05 const objB = objA;
06
07 changeValue(objB);
08 const result = objA.value;
What is the value of result?
Refer to the code declarations below:
let str1 = ' Java ' ;
let str2 = ' Script ' ;
Which three expressions return the string JavaScript?
A developer imports:
import printPrice from ' /path/PricePrettyPrint.js ' ;
What must be true about printPrice for this import to work?
Given a value, which two options can a developer use to detect if the value is NaN?
A developer publishes a new version of a package with bug fixes but no breaking changes. The old version number was 2.1.1.
What should the new package version number be based on semantic versioning?