is the output of line 02?Free JS-101 Practice Test Questions and Answers (2026) Practice Questions
Free preview: 20 questions.
Salesforce Javascript Developer I
Q: 1
Given the following code:
is the output of line 02?
is the output of line 02?Options
Discussion
Its B. I figure null is its own type, so typeof should return 'null'. Not sure why object would make sense here since null isn't really an object. Anyone recall seeing otherwise?
Be respectful. No spam.
Q: 2
Which statement phrases successfully?
Options
Discussion
Why do they always use weird quotes in these options? Not seeing any real-world JSON with those, honestly. Is there some trick I'm missing in D or is that just supposed to be double quotes inside single?
Be respectful. No spam.
Q: 3
Given the code below:
const delay = sync delay => {
Return new Promise((resolve, reject) => {
setTimeout (resolve,delay);});};
const callDelay =async () =>{
const yup =await delay(1000);
console.log(1);
What is logged to the console?
Options
Discussion
D Is "best" referring to speed or order of async output? Would sequential calls change the answer?
Be respectful. No spam.
Q: 4
developer is trying to convince management that their team will benefit from using
Node.js for a backend server that they are going to create. The server will be a web server that
handles API requests from a website that the teamhas already built using HTML, CSS, and
JavaScript.
Which three benefits of Node.js can the developer use to persuade their manager?
Choose 3 answers:
Options
Discussion
D imo, but is the question asking for most important benefits, or literally any three? If stability (option B) was a bigger priority due to strict release cycles, that could maybe change the picks.
Be respectful. No spam.
Q: 5
Refer to the following code:
What is the value of output on line 11?
What is the value of output on line 11?Options
Discussion
D
Good question, the output won't be assigned since the code tries to use
for...of on myMap.entries without calling it as a function. That's a method, not an iterable by itself, so you'll get a TypeError here. Clear example of how JS iteration works.Be respectful. No spam.
Q: 6
A developer creates a class that represents a blog post based on the requirement that a
Post should have a body author and view count.
The Code shown Below:
Class Post{
// Insert code here
This.body =body
This.author = author;
this.viewCount = viewCount;
}
}
Which statement should be inserted in the placeholder on line 02 to allow for a variable to be set
to a new instanceof a Post with the three attributes correctly populated?
Options
Discussion
Option C, constructor(body, author, viewCount), is correct. That's the valid way to set parameters for a class object in modern JavaScript. B looks like old function syntax and A's a common trap for people coming from inheritance. Let me know if you disagree.
Probably C here, since constructor(body, author, viewCount) is the right way to initialize all three fields in a JS class.
Be respectful. No spam.
Q: 7
Refer to the code below:
Function Person(firstName, lastName, eyecolor) {
this.firstName =firstName;
this.lastName = lastName;
this.eyeColor = eyeColor;
}
Person.job = ‘Developer’;
const myFather = new Person(‘John’, ‘Doe’);
console.log(myFather.job);
What is the output after the code executes?
Options
Discussion
Option A here. The trap is D but the typo in the parameter name (eyecolor vs eyeColor) means ReferenceError is thrown, so myFather doesn't even get created. Seen similar Qs in practice exams.
A tbh, looks like the typo in eyeColor causes a ReferenceError. Can someone confirm if that's right?
Be respectful. No spam.
Q: 8
Given the JavaScript below:
Which code should replace the placeholder comment on line 06 to hide accounts that do not match
the search string?
Which code should replace the placeholder comment on line 06 to hide accounts that do not match
the search string?Options
Discussion
Probably D here since display should be 'block' when matched, 'none' for non-matches. Just watch out if the list elements are something other than , but for standard lists this fits. Anyone see a case where it wouldn't?
Be respectful. No spam.
Q: 9
A team that works on a big project uses npm to deal with projects dependencies.
A developer added a dependency does not get downloaded when they execute npm
install.
Which two reasons could be possible explanations for this?
Choose 2 answers
Options
Discussion
Probably B and C. If NODE_ENV is production, dev dependencies can be skipped, and missing -save would keep it out of package.json.
Be respectful. No spam.
Q: 10
Refer to the code snippet:
Function getAvailabilityMessage(item) {
If (getAvailability(item)){
Var msg =”Username available”;
}
Return msg;
}
A developer writes this code to return a message to user attempting to register a new
username. If the username is available, variable.
What is the return value of msg hen getAvailabilityMessage (“newUserName” ) is
executed and getAvailability(“newUserName”) returns false?
Options
Discussion
Pretty sure it would be C. Msg hasn't been set so it's not defined, right?
Be respectful. No spam.
Q: 11
A developer wants to use a module called DataPrettyPrint. This module exports one default
functioncalled printDate ().
How can a developer import and use the printDate() function?
A)
B)
C)
D)

B)
C)
D)

Options
Discussion
Option D but does the question specify if printDate should keep its name after import or if any alias is ok? If naming matters, that could change which import syntax is correct.
Be respectful. No spam.
Q: 12
A developer has a formatName function that takes two arguments, firstName and lastName and
returns a string. They want to schedule the
function to run once after five seconds.
What is the correct syntax toschedule this function?
Options
Discussion
C vs D, but pretty sure it's C. Option C uses an arrow function for proper argument passing, even if the typo's throwing people off. D is just a string reference, which won't execute the function as expected. Anyone see it differently?
C or D? C is right conceptually since setTimeout needs a function reference, not a direct call, even though there are typos in the option. Really clear question compared to others I’ve seen.
Be respectful. No spam.
Q: 13
Refer the code below.
x=3.14;
function myfunction() {
"use strict";
y=x;
}
z=x;
myFunction();
Your Answer
Discussion
Had exactly this question in my exam. z will be 3.14.
Be respectful. No spam.
Q: 14
Refer to the code below:
Const myFunction = arr => {
Return arr.reduce((result, current) =>{
Return result = current;
}, 10};
}
What is the output of this function when called with an empty array ?
Options
Discussion
Not C, D
Be respectful. No spam.
Q: 15
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?
What is the output of the code execution?Options
Discussion
Its D
Be respectful. No spam.
Q: 16
Referto the code below:
new Promise((resolve, reject) => {
const fraction = Math.random();
if( fraction >0.5) reject("fraction > 0.5, " + fraction);
resolve(fraction);
})
.then(() =>console.log("resolved"))
.catch((error) => console.error(error))
.finally(() =>console.log(" when am I called?"));
When does Promise.finally on line 08 get called?
When does Promise.finally on line 08 get called?Options
Discussion
D imo. finally() runs when the promise is settled, no matter if it resolves or rejects. Great for cleanup stuff you want to always happen. Don't think it's limited to just resolved or just rejected.
Be respectful. No spam.
Q: 17
Refer to the string below.
Const str=’Salesforce’;
Which two statementsresults in the word 'Sales'?
Your Answer
Discussion
Totally not sure here, but str.substring(0,5) and str.substr(0,5) I think.
Be respectful. No spam.
Q: 18
A developer creates a simple webpage with an input field. When a user enters text in
the inputfield and clicks the button, the actual value of the field must be displayed in the
console.
Here is the HTML file content:
The developer wrote the javascript codebelow:
Const button = document.querySelector(‘button’);
button.addEvenListener(‘click’, () => (
Const input = document.querySelector(‘input’);
console.log(input.getAttribute(‘value’));
When the user clicks the button, the output is always “Hello”.
What needs to be done make this code work as expected?
Options
Discussion
A
Be respectful. No spam.
Q: 19
Given the HTML below:
Which statement adds the priority-account CSS class to the Universal Containers row?
Which statement adds the priority-account CSS class to the Universal Containers row?Options
Discussion
Probably B
Be respectful. No spam.
Q: 20
The developer wants to test the array shown:
const arr = Array(5).fill(0)
Which two tests are the most accurate for this array ?
Choose 2 answers:
Options
Discussion
Not C, A and B. Saw similar question in exam reports, both check exactly what the array should look like.
A and B. Checks length and confirms all values are 0, makes sense for this array.
Be respectful. No spam.
Question 1 of 20