ExamGecko
Ask Question

Salesforce Certified JavaScript Developer I Practice Test - Questions Answers, Page 2

List of questions

Question 11

Report Export Collapse

Given the JavaScript below:

01 function filterDOM (searchString) {

02 const parsedSearchString = searchString && searchString.toLowerCase() ; 03 document.quesrySelectorAll(' .account' ) . forEach(account => ( 04 const accountName = account.innerHTML.toLOwerCase(); 05 account. Style.display =

accountName.includes(parsedSearchString) ? /*Insert code*/; 06 )}; 07 } Which code should replace the placeholder comment on line 05 to hide accounts that do not match the search string?

' name ' : ' block '
' name ' : ' block '
' Block ' : ' none '
' Block ' : ' none '
' visible ' : ' hidden '
' visible ' : ' hidden '
' hidden ' : ' visible '
' hidden ' : ' visible '
Suggested answer: B
asked 23/09/2024
Peter Lilley
58 questions

Question 12

Report Export Collapse

developer publishes a new version of a package with new features that do not break backward compatibility. The previous version number was 1.1.3.

Following semantic versioning format, what should the new package version number be?

2.0.0
2.0.0
1.2.3
1.2.3
1.1.4
1.1.4
1.2.0
1.2.0
Suggested answer: D
asked 23/09/2024
Gilbert Ciepluch
60 questions

Question 13

Report Export Collapse

A developer is creating a simple webpage with a button. When a user clicks this button for the first time, a message is displayed.

The developer wrote the JavaScript code below, but something is missing. The message gets displayed every time a user clicks the button, instead of just the first time.

01 function listen(event) {

02 alert ( 'Hey! I am John Doe') ;

03 button.addEventListener ('click', listen);

Which two code lines make this code work as required?

Choose 2 answers

On line 02, use event.first to test if it is the first execution.
On line 02, use event.first to test if it is the first execution.
On line 04, use event.stopPropagation ( ),
On line 04, use event.stopPropagation ( ),
On line 04, use button.removeEventListener(' click" , listen);
On line 04, use button.removeEventListener(' click" , listen);
On line 06, add an option called once to button.addEventListener().
On line 06, add an option called once to button.addEventListener().
Suggested answer: C, D
asked 23/09/2024
hajar mechrany
33 questions

Question 14

Report Export Collapse

A developer uses a parsed JSON string to work with user information as in the block below:

01 const userInformation ={

02 " id " : "user-01",

03 "email" : "[email protected]",

04 "age" : 25

Which two options access the email attribute in the object?

Choose 2 answers

userInformation("email")
userInformation("email")
userInformation.get("email")
userInformation.get("email")
userInformation.email
userInformation.email
userInformation(email)
userInformation(email)
Suggested answer: A, C
asked 23/09/2024
Harri rrapaj
34 questions

Question 15

Report Export Collapse

Refer to the code below:

01 const server = require('server');

02 /* Insert code here */

A developer imports a library that creates a web server. The imported library uses events and callbacks to start the servers Which code should be inserted at the line 03 to set up an event and start the web server ?

Server.start ();
Server.start ();
server.on(' connect ' , ( port) => { console.log('Listening on ' , port) ;})
server.on(' connect ' , ( port) => { console.log('Listening on ' , port) ;})
server()
server()
serve(( port) => (
serve(( port) => (
console.log( 'Listening on ', port) ;
console.log( 'Listening on ', port) ;
Suggested answer: B
asked 23/09/2024
adnan ayyash
48 questions

Question 16

Report Export Collapse

A developer wants to iterate through an array of objects and count the objects and count the objects whose property value, name, starts with the letter N.

Const arrObj = [{"name" : "Zach"} , {"name" : "Kate"},{"name" : "Alise"},{"name" : "Bob"},{"name" :

"Natham"},{"name" : "nathaniel"}

Refer to the code snippet below:

01 arrObj.reduce(( acc, curr) => {

02 //missing line 02

02 //missing line 03

04 ). 0);

Which missing lines 02 and 03 return the correct count?

Const sum = curr.startsWith('N') ? 1: 0;Return acc +sum
Const sum = curr.startsWith('N') ? 1: 0;Return acc +sum
Const sum = curr.name.startsWith('N') ? 1: 0;Return acc +sum
Const sum = curr.name.startsWith('N') ? 1: 0;Return acc +sum
Const sum = curr.startsWIth('N') ? 1: 0;Return curr+ sum
Const sum = curr.startsWIth('N') ? 1: 0;Return curr+ sum
Const sum = curr.name.startsWIth('N') ? 1: 0;Return curr+ sum
Const sum = curr.name.startsWIth('N') ? 1: 0;Return curr+ sum
Suggested answer: B
asked 23/09/2024
Mr. Michael Mettam
33 questions

Question 17

Report Export Collapse

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?

super (body, author, viewCount) {
super (body, author, viewCount) {
Function Post (body, author, viewCount) {
Function Post (body, author, viewCount) {
constructor (body, author, viewCount) {
constructor (body, author, viewCount) {
constructor() {
constructor() {
Suggested answer: C
asked 23/09/2024
Sorin Craia
41 questions

Question 18

Report Export Collapse

Which three options show valid methods for creating a fat arrow function?

Choose 3 answers

x => ( console.log(' executed ') ; )
x => ( console.log(' executed ') ; )
[ ] => ( console.log(' executed ') ;)
[ ] => ( console.log(' executed ') ;)
( ) => ( console.log(' executed ') ;)
( ) => ( console.log(' executed ') ;)
X,y,z => ( console.log(' executed ') ;)
X,y,z => ( console.log(' executed ') ;)
(x,y,z) => ( console.log(' executed ') ;)
(x,y,z) => ( console.log(' executed ') ;)
Suggested answer: A, E
asked 23/09/2024
Victor Silveira
31 questions

Question 19

Report Export Collapse

Refer to the code below: const event = new CustomEvent(

//Missing Code

); obj.dispatchEvent(event); A developer needs to dispatch a custom event called update to send information about recordId.

Which two options could a developer insert at the placeholder in line 02 to achieve this?

Choose 2 answers

'Update' , ( recordId : '123abc'(
'Update' , ( recordId : '123abc'(
'Update' , '123abc'
'Update' , '123abc'
{ type : 'update', recordId : '123abc' }
{ type : 'update', recordId : '123abc' }
'Update' , {Details : { recordId : '123abc'}}
'Update' , {Details : { recordId : '123abc'}}
Suggested answer: A, D
asked 23/09/2024
law ryan
35 questions

Question 20

Report Export Collapse

Refer to the code below:

Const pi = 3.1415326,

What is the data type of pi?

Double
Double
Number
Number
Decimal
Decimal
Float
Float
Suggested answer: B
asked 23/09/2024
Adam Vce
41 questions
Total 224 questions
Go to page: of 23
Search

Related questions