Salesforce Certified JavaScript Developer - Multiple Choice (JS-Dev-101) Free Practice Test
Question 1
Refer to the following code (correcting the missing template literal backticks):
let codeName = 'Bond';
let sampleText = `The name is ${codeName}, Jim ${codeName}`;
A developer is trying to determine if a certain substring is part of a string.
Which three code statements return true?
let codeName = 'Bond';
let sampleText = `The name is ${codeName}, Jim ${codeName}`;
A developer is trying to determine if a certain substring is part of a string.
Which three code statements return true?
Correct Answer: A,C,E
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 2
Given two expressions, exp1 and exp2, which two valid ways return the logical AND of the two expressions and ensure it is a Boolean?
Correct Answer: B,D
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 3
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?
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?
Correct Answer: C
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 4
A developer needs the function personalizeWebsiteContent to run when the webpage is fully loaded (HTML and all external resources).
Which implementation should be used?
Which implementation should be used?
Correct Answer: C
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 5
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?
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?
Correct Answer: A,B
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 6
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?
<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?
Correct Answer: A
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 7
Given a value, which three options can a developer use to detect if the value is NaN?
Correct Answer: A,C,E
Question 8
Refer to the following object:
const dog = {
firstName: 'Beau',
lastName: 'Boo',
get fullName() {
return this.firstName + ' ' + this.lastName;
}
};
How can a developer access the fullName property for dog?
const dog = {
firstName: 'Beau',
lastName: 'Boo',
get fullName() {
return this.firstName + ' ' + this.lastName;
}
};
How can a developer access the fullName property for dog?
Correct Answer: D
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 9
Refer to the HTML below:
<div id="main">
<ul>
<li>Leo</li>
<li>Tony</li>
<li>Tiger</li>
</ul>
</div>
Which JavaScript statement results in changing "Leo" to "The Lion"?
<div id="main">
<ul>
<li>Leo</li>
<li>Tony</li>
<li>Tiger</li>
</ul>
</div>
Which JavaScript statement results in changing "Leo" to "The Lion"?
Correct Answer: B
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).