ExamGecko
Home Home / Salesforce / Certified JavaScript Developer I

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

Question list
Search
Search

List of questions

Search

Related questions











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?

A.
' name ' : ' block '
A.
' name ' : ' block '
Answers
B.
' Block ' : ' none '
B.
' Block ' : ' none '
Answers
C.
' visible ' : ' hidden '
C.
' visible ' : ' hidden '
Answers
D.
' hidden ' : ' visible '
D.
' hidden ' : ' visible '
Answers
Suggested answer: B

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?

A.
2.0.0
A.
2.0.0
Answers
B.
1.2.3
B.
1.2.3
Answers
C.
1.1.4
C.
1.1.4
Answers
D.
1.2.0
D.
1.2.0
Answers
Suggested answer: D

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

A.
On line 02, use event.first to test if it is the first execution.
A.
On line 02, use event.first to test if it is the first execution.
Answers
B.
On line 04, use event.stopPropagation ( ),
B.
On line 04, use event.stopPropagation ( ),
Answers
C.
On line 04, use button.removeEventListener(' click" , listen);
C.
On line 04, use button.removeEventListener(' click" , listen);
Answers
D.
On line 06, add an option called once to button.addEventListener().
D.
On line 06, add an option called once to button.addEventListener().
Answers
Suggested answer: C, D

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

A.
userInformation("email")
A.
userInformation("email")
Answers
B.
userInformation.get("email")
B.
userInformation.get("email")
Answers
C.
userInformation.email
C.
userInformation.email
Answers
D.
userInformation(email)
D.
userInformation(email)
Answers
Suggested answer: A, C

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 ?

A.
Server.start ();
A.
Server.start ();
Answers
B.
server.on(' connect ' , ( port) => { console.log('Listening on ' , port) ;})
B.
server.on(' connect ' , ( port) => { console.log('Listening on ' , port) ;})
Answers
C.
server()
C.
server()
Answers
D.
serve(( port) => (
D.
serve(( port) => (
Answers
E.
console.log( 'Listening on ', port) ;
E.
console.log( 'Listening on ', port) ;
Answers
Suggested answer: B

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?

A.
Const sum = curr.startsWith('N') ? 1: 0;Return acc +sum
A.
Const sum = curr.startsWith('N') ? 1: 0;Return acc +sum
Answers
B.
Const sum = curr.name.startsWith('N') ? 1: 0;Return acc +sum
B.
Const sum = curr.name.startsWith('N') ? 1: 0;Return acc +sum
Answers
C.
Const sum = curr.startsWIth('N') ? 1: 0;Return curr+ sum
C.
Const sum = curr.startsWIth('N') ? 1: 0;Return curr+ sum
Answers
D.
Const sum = curr.name.startsWIth('N') ? 1: 0;Return curr+ sum
D.
Const sum = curr.name.startsWIth('N') ? 1: 0;Return curr+ sum
Answers
Suggested answer: B

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?

A.
super (body, author, viewCount) {
A.
super (body, author, viewCount) {
Answers
B.
Function Post (body, author, viewCount) {
B.
Function Post (body, author, viewCount) {
Answers
C.
constructor (body, author, viewCount) {
C.
constructor (body, author, viewCount) {
Answers
D.
constructor() {
D.
constructor() {
Answers
Suggested answer: C

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

Choose 3 answers

A.
x => ( console.log(' executed ') ; )
A.
x => ( console.log(' executed ') ; )
Answers
B.
[ ] => ( console.log(' executed ') ;)
B.
[ ] => ( console.log(' executed ') ;)
Answers
C.
( ) => ( console.log(' executed ') ;)
C.
( ) => ( console.log(' executed ') ;)
Answers
D.
X,y,z => ( console.log(' executed ') ;)
D.
X,y,z => ( console.log(' executed ') ;)
Answers
E.
(x,y,z) => ( console.log(' executed ') ;)
E.
(x,y,z) => ( console.log(' executed ') ;)
Answers
Suggested answer: A, E

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

A.
'Update' , ( recordId : '123abc'(
A.
'Update' , ( recordId : '123abc'(
Answers
B.
'Update' , '123abc'
B.
'Update' , '123abc'
Answers
C.
{ type : 'update', recordId : '123abc' }
C.
{ type : 'update', recordId : '123abc' }
Answers
D.
'Update' , {Details : { recordId : '123abc'}}
D.
'Update' , {Details : { recordId : '123abc'}}
Answers
Suggested answer: A, D

Refer to the code below:

Const pi = 3.1415326,

What is the data type of pi?

A.
Double
A.
Double
Answers
B.
Number
B.
Number
Answers
C.
Decimal
C.
Decimal
Answers
D.
Float
D.
Float
Answers
Suggested answer: B
Total 224 questions
Go to page: of 23