Last Updated On : 29-Jun-2026
Salesforce Certified JavaScript Developer - JS-Dev-101 Practice Test
Prepare with our free Salesforce Certified JavaScript Developer - JS-Dev-101 sample questions and pass with confidence. Our Salesforce-JavaScript-Developer practice test is designed to help you succeed on exam day.
Salesforce 2026
A developer wants to use a module called DatePrettyPrint.
This module exports one default function called printDate().
How can the developer import and use printDate()?
A. import DatePrettyPrint() from ' /path/DatePrettyPrint.js ' ;
printDate();
B. import DatePrettyPrint from ' /path/DatePrettyPrint.js ' ;
DatePrettyPrint.printDate();
C. import printDate from ' /path/DatePrettyPrint.js ' ;
DatePrettyPrint.printDate();
D. import printDate from ' /path/DatePrettyPrint.js ' ;
printDate();
printDate();
A developer creates a class that represents a news story based on the requirements that a Story should have a body, author, and view count. The code is shown below:
01 class Story {
02 // Insert code here
03 this.body = body;
04 this.author = author;
05 this.viewCount = viewCount;
06 }
07 }
Which statement should be inserted in the placeholder on line 02 to allow for a variable to be set to a new instance of a Story with the three attributes correctly populated?
A. constructor() {
B. super(body, author, viewCount) {
C. function Story(body, author, viewCount) {
D. constructor(body, author, viewCount) {
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?
A. [1,2,3,4,5,4]
B. [1,2,3,5]
C. [1,2,3,4,5,4,4]
D. [1,2,3,4,4,5,4]
Refer to the following code:
< html lang= " en " >
< body >
< button class= " secondary " > Save draft < /button >
< button class= " primary " > Save and close < /button >
< /body >
< script >
function displaySaveMessage(event) {
console.log( ' Save message. ' );
}
function displaySuccessMessage(event) {
console.log( ' Success message. ' );
}
window.onload = function() {
document.querySelector( ' .secondary ' )
.addEventListener( ' click ' , displaySaveMessage, true);
document.querySelector( ' .primary ' )
.addEventListener( ' click ' , displaySuccessMessage, true);
}
< /script >
< /html >
A. > Outer message
B. > Outer message
Inner message
C. > Inner message
D. > Inner message
Outer message
Inner message
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);
08 if (file) reader.readAsDataURL(file);
| Salesforce-JavaScript-Developer Exam Questions - Home | Previous |
| Page 4 out of 55 Pages |