Salesforce certification preparation

JS-Dev-101 Practice Questions

Practice exam-style questions, check your answers, and review explanations and source references where they are available.

Exam
JS-Dev-101
Provider
Salesforce
Full set
148 questions
Last Update Check
A developer executes: document.cookie; document.cookie = 'key=John Smith'; What is the behavior?
Answer options
A developer is required to write a function that calculates the sum of elements in an array but is getting undefined every time the code is executed. The developer needs to find what is missing in the code below. 01 const sumFunction = arr => { 02 return arr.reduce((result, current) => { 03 // 04 result += current; 05 // 06 }, 10); 07 }; Which line replacement makes the code work as expected?
Answer options
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?
Answer options
01 function Animal(size, type) { 02 this.type = type || 'Animal'; 03 this.canTalk = false; 04 } 05 06 Animal.prototype.speak = function() { 07 if (this.canTalk) { 08 console.log("It spoke!"); 09 } 10 }; 11 12 let Pet = function(size, type, name, owner) { 13 Animal.call(this, size, type); 14 this.size = size; 15 this.name = name; 16 this.owner = owner; 17 } 18 19 Pet.prototype = Object.create(Animal.prototype); 20 let pet1 = new Pet(); Given the code above, which three properties are set for pet1?
Answer options
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?
Answer options
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?
Answer options
Given a value, which two options can a developer use to detect if the value is NaN?
Answer options
A developer wants to use a module named universalContainerslib and then call functions from it. How should a developer import every function from the module and then call the functions foo and bar?
Answer options
A developer creates a simple webpage with an input field. When a user enters text and clicks the button, the actual value must be displayed in the console: HTML: JavaScript: 01 const button = document.querySelector('button'); 02 button.addEventListener('click', () => { 03 const input = document.querySelector('input'); 04 console.log(input.getAttribute('value')); 05 }); When the user clicks the button, the output is always "Hello". What needs to be done to make this code work as expected?
Answer options
Refer to the following object: 01 const cat = { 02 firstName: 'Fancy', 03 lastName: 'Whiskers', 04 get fullName(){ 05 return this.firstName + ' ' + this.lastName; 06 } 07 }; How can a developer access the fullName property for cat?
Answer options
Question 1 of 10

Source context

How this practice set is maintained

Maintained by the CertMage content team, this page loads questions from the exam dataset connected to its preparation resource. When an answer includes a supporting reference, it is shown with that answer so you can review the underlying vendor documentation.

Certification objectives, interfaces, and vendor services can change. Verify important details against the provider's current exam guide and documentation before your exam.

Scroll to Top