JavaScript-Developer-I Practice Questions
Salesforce Certified JavaScript Developer (JS-Dev-101)
Last Update 1 day ago
Total Questions : 147
Dive into our fully updated and stable JavaScript-Developer-I practice test platform, featuring all the latest Salesforce Developer exam questions added this week. Our preparation tool is more than just a Salesforce study aid; it's a strategic advantage.
Our free Salesforce Developer practice questions crafted to reflect the domains and difficulty of the actual exam. The detailed rationales explain the 'why' behind each answer, reinforcing key concepts about JavaScript-Developer-I. Use this test to pinpoint which areas you need to focus your study on.
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?
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?
Given two expressions var1 and var2, what are two valid ways to return the concatenation of the two expressions and ensure it is data type string?
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 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?
Refer to the following code block:
01 let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
02 let output = 0;
03
04 for (let num of array) {
05 if (output > 10) {
06 break;
07 }
08 if (num % 2 == 0) {
09 continue;
10 }
11 output += num;
12 }
What is the value of output after the code executes?
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?
Refer to the code below (assuming Promise.race is intended):
let cat3 = new Promise(resolve = >
setTimeout(resolve, 3000, " Cat 3 completes " )
);
Promise.race([cat1, cat2, cat3])
.then(value = > {
let result = `${value} the race.`;
})
.catch(err = > {
console.log( " Race is cancelled: " , err);
});
(Assuming cat1 and cat2 are similar to earlier examples: cat2 resolves fastest.)
What is the value of result when Promise.race executes?
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?
A developer removes the HTML class attribute from the checkout button, so now it is simply:
< button > Checkout < /button >
There is a test to verify the existence of the checkout button, however it looks for a button with class= " blue " . The test fails because no such button is found.
Which type of test category describes this test?
