live chatMcAfee Secure sites help keep you safe from identity theft, credit card fraud, spyware, spam, viruses and online scams
Pass4Test 10%OFF Discount Code

Salesforce Certified JavaScript Developer - Multiple Choice - JS-Dev-101 Exam Questions

QUESTION NO: 1
A developer initiates a server with the file server.js and adds dependencies in the source code's package.json that are required to run the server.
Which command should the developer run to start the server locally?
Correct Answer: C
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 2
A developer at Universal Containers creates a new landing page based on HTML, CSS, and JavaScript.
To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed to do some custom initialization when the webpage is fully loaded with HTML content and all related files.
Which statement should be used to call personalizeWebsiteContent based on the above business requirement?
Correct Answer: B
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 3
A team at Universal Containers works on a big project and uses Yarn to deal with the project's dependencies. A developer added a dependency to manipulate dates and pushed the updates to the remote repository. The rest of the team complains that the dependency does not get downloaded when they execute yarn.
What could be the reason for this?
Correct Answer: D
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 4
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"?
Correct Answer: D
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 5
A team at Universal Containers works on a big project and uses yarn to manage the project's dependencies.
A developer added a dependency to manipulate dates and pushed the updates to the remote repository. The rest of the team complains that the dependency does not get downloaded when they execute yarn.
What could be the reason for this?
Correct Answer: D
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 6
01 function changeValue(obj) {
02 obj.value = obj.value / 2;
03 }
04 const objA = { value: 10 };
05 const objB = objA;
06
07 changeValue(objB);
08 const result = objA.value;
What is the value of result?
Correct Answer: D
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 7
Refer to the following code block (with corrected template literals using backticks):
01 class Animal {
02 constructor(name) {
03 this.name = name;
04 }
05
06 makeSound() {
07 console.log(`${this.name} is making a sound.`);
08 }
09 }
10
11 class Dog extends Animal {
12 constructor(name) {
13 super(name);
14 this.name = name;
15 }
16 makeSound() {
17 console.log(`${this.name} is barking.`);
18 }
19 }
20
21 let myDog = new Dog('Puppy');
22 myDog.makeSound();
What is the console output?
Correct Answer: B
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 8
Refer to the code below:
01 <html lang="en">
02 <table onclick="console.log('Table log');">
03 <tr id="row1">
04 <td>Click me!</td>
05 </tr>
06 </table>
07 <script>
08 function printMessage(event) {
09 console.log('Row log');
10 event.stopPropagation();
11 }
12
13 let elem = document.getElementById('row1');
14 elem.addEventListener('click', printMessage, false);
15 </script>
16 </html>
Which code change should be done for the console to log the following when "Click me!" is clicked?
Row log
Table log
Correct Answer: A
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).
QUESTION NO: 9
Refer to the code:
01 function execute() {
02 return new Promise((resolve, reject) => reject());
03 }
04 let promise = execute();
05
06 promise
07 .then(() => console.log('Resolved1'))
08 .then(() => console.log('Resolved2'))
09 .then(() => console.log('Resolved3'))
10 .catch(() => console.log('Rejected'))
11 .then(() => console.log('Resolved4'));
What is the result when the Promise in the execute function is rejected?
Correct Answer: C
Explanation: Only visible for Pass4Test members. You can sign-up / login (it's free).