Salesforce javascript developer i practice test

Exam Title: Salesforce Certified JavaScript Developer

Last update: Dec 06 ,2025
Question 1

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 thesearch string?

  • A. ‘ name ’ : ‘ block ’
  • B. ‘ Block ’ : ‘ none ’
  • C. ‘ visible ’ : ‘ hidden ’
  • D. ‘ hidden ’ : ‘ visible ’
Answer:

B


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 2

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
  • B. 1.2.3
  • C. 1.1.4
  • D. 1.2.0
Answer:

A


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 1
Comments
Question 3

A developer is creating a simple webpage with a button. When a userclicks 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 functionlisten(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.
  • B. On line 04, useevent.stopPropagation ( ),
  • C. On line 04, use button.removeEventListener(‘ click” , listen);
  • D. On line 06, add an option called once to button.addEventListener().
Answer:

C,D


vote your answer:
A
B
C
D
A 0 B 0 C 1 D 1
Comments
Question 4

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”)
  • B. userInformation.get(“email”)
  • C. userInformation.email
  • D. userInformation(email)
Answer:

A,C


vote your answer:
A
B
C
D
A 0 B 0 C 1 D 0
Comments
Question 5

Refer to the code below:
01 const server = require(‘server’);
02 /* Insert code here */
A developer imports a library that creates a web server. Theimported 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 ();
  • B. server.on(‘ connect ’ , ( port) => {console.log(‘Listening on ’ , port) ;})
  • C. server()
  • D. serve(( port) => (
  • E. console.log( ‘Listening on ’, port) ;
Answer:

B


vote your answer:
A
B
C
D
E
A 0 B 1 C 0 D 0 E 0
Comments
Question 6

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 letterN.
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
  • B. Const sum = curr.name.startsWith(‘N’) ? 1: 0;Return acc +sum
  • C. Const sum = curr.startsWIth(‘N’) ? 1: 0;Return curr+ sum
  • D. Const sum =curr.name.startsWIth(‘N’) ? 1: 0;Return curr+ sum
Answer:

B


vote your answer:
A
B
C
D
A 0 B 1 C 0 D 0
Comments
Question 7

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) {
  • B. Function Post (body, author, viewCount) {
  • C. constructor (body, author, viewCount) {
  • D. constructor() {
Answer:

C


vote your answer:
A
B
C
D
A 0 B 0 C 1 D 0
Comments
Question 8

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

  • A. x => ( console.log(‘ executed ’) ; )
  • B. [ ] => ( console.log(‘ executed ’) ;)
  • C. ( ) => ( console.log(‘ executed ’) ;)
  • D. X,y,z => ( console.log(‘ executed ’) ;)
  • E. (x,y,z) => ( console.log(‘ executed ’) ;)
Answer:

A,E


vote your answer:
A
B
C
D
E
A 1 B 0 C 1 D 0 E 1
Comments
Question 9

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’(
  • B. ‘Update’ , ‘123abc’
  • C. { type : ‘update’, recordId : ‘123abc’ }
  • D. ‘Update’ , {Details : {recordId : ‘123abc’}}
Answer:

A,D


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 1
Comments
Question 10

Refer to thecode below:
Const pi = 3.1415326,
What is the data type of pi?

  • A. Double
  • B. Number
  • C. Decimal
  • D. Float
Answer:

B


vote your answer:
A
B
C
D
A 0 B 1 C 0 D 0
Comments
Page 1 out of 21
Viewing questions 1-10 out of 219
Go To
page 2