Salesforce javascript developer i practice test

Certified JavaScript Developer I

Last exam update: Dec 23 ,2024
Page 1 out of 12. Viewing questions 1-15 out of 180

Question 1

Refer to the code below:

What is the output of this function when called with an empty array?

  • A. Return 0
  • B. Return 5
  • C. Return NaN
  • D. Return Infinity
Mark Question:
Answer:

B


User Votes:
A
50%
B 6 votes
50%
C 2 votes
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 2

A developer at Universal Containers is creating their new landing page based on HTML, CSS, and
JavaScript. The website includes multiple external resources that are loaded when the page is
opened.
To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to
be executed when the webpage Is loaded and there Is no need to wait for the resources to be
available.
Which statement should be used to call personalizeWebsiteContent based on the above business
requirement?

  • A. windows,addEventListener('load', personalizeWebsiteContent);
  • B. windows,addEventListener('DOMContent Loaded ', personalizeWebsiteContent);
  • C. windows,addEventListener('onload', personalizeWebsiteContent);
  • D. windows,addEventListener('onDOMCContentLoaded', personalizeWebsiteContent);
Mark Question:
Answer:

A


User Votes:
A 3 votes
50%
B 1 votes
50%
C 2 votes
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
rahulntsh
5 months, 1 week ago

you should use the DOMContentLoaded event. This event is fired when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.


Question 3

A developer is setting up a Node,js server and is creating a script at the root of the source code,
index,js, that will start the server when executed. The developer declares a variable that needs the
folder location that the code executes from.
Which global variable can be used in the script?

  • A. window.location
  • B. _filename
  • C. _dirname
  • D. this.path
Mark Question:
Answer:

B


User Votes:
A
50%
B 2 votes
50%
C 1 votes
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
rahulntsh
5 months, 1 week ago

In this script, when the server starts, it will log the directory from which the script is executed using the __dirname variable.

rahulntsh
5 months, 1 week ago

In this script, when the server starts, it will log the directory from which the script is executed using the __dirname variable.


Question 4

A developer copied a JavaScript object:

How does the developer access dan's forstName,lastName? Choose 2 answers

  • A. dan,name
  • B. dan,firstname ( ) + dan, lastName ( )
  • C. dan, firstName = dan.lastName
  • D. dan,name ( )
Mark Question:
Answer:

C, D


User Votes:
A
50%
B
50%
C 2 votes
50%
D 3 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 5

There is a new requirement for a developer to implement a currPrice method that will return the
current price of the item or sales..

What is the output when executing the code above
A.
Uncaught TypeError: saleItem,desrcription is not a function
B.
C.
D.
Uncaught Reference Error:this,discount is undefined

Mark Question:
Answer:

B


User Votes:
Discussions
vote your answer:
0 / 1000

Question 6

Given the following code:

What will be the first four numbers logged?

  • A. 0012
  • B. 0112
  • C. 0122
  • D. 0123
Mark Question:
Answer:

B


User Votes:
A
50%
B 1 votes
50%
C 1 votes
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
hagamablabla
7 months ago

The first interval runs after 1000 ms, the second interval runs after 2000 ms. The timeout will run after 2100 ms, which happens after the second interval. Because the interval runs counter++ twice, the second number should be 2, not 1.


Question 7

Refer to the following object.

How can a developer access the fullName property for dog?

  • A. Dog.fullName
  • B. Dog.fullName ( )
  • C. Dog, get, fullName
  • D. Dog, function, fullName
Mark Question:
Answer:

A


User Votes:
A 1 votes
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 8

A developer needs to debug a Node.js web server because a runtime error keeps occurring at one of
the endpoints.
The developer wants to test the endpoint on a local machine and make the request against a local
server to look at the behavior. In the source code, the server, js file will start the server. the developer
wants to debug the Node.js server only using the terminal.
Which command can the developer use to open the CLI debugger in their current terminal window?

  • A. node -i server.js
  • B. node inspect server,js
  • C. node server,js inspect
  • D. node start inspect server,js
Mark Question:
Answer:

B


User Votes:
A
50%
B 1 votes
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 9

Given the expressions var1 and var2, what are two valid ways to return the concatenation of the two
expressions and ensure it is string? Choose 2 answers

  • A. var1 + var2
  • B. var1.toString ( ) var2.toString ( )
  • C. String (var1) .concat (var2)
  • D. string.concat (var1 +var2)
Mark Question:
Answer:

B, D


User Votes:
A
50%
B 2 votes
50%
C 1 votes
50%
D 1 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
hagamablabla
7 months ago

D is incorrect because concat() is not a static variable. The correct way to call concat() is C.


Question 10

bar, awesome is a popular JavaScript module. the versions publish to npm are:

Teams at Universal Containers use this module in a number of projects. A particular project has the
package, json definition below.

A developer runs this command: npm install.
Which version of bar .awesome is installed?

  • A. 1.3.1
  • B. 1.3.5
  • C. The command fails, because version 130 is not found
  • D. 1.4.0
Mark Question:
Answer:

B


User Votes:
A
50%
B 2 votes
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 11

A developer is trying to handle an error within a function.
Which code segment shows the correct approach to handle an error without propagating it
elsewhere?
A)

B)

C)

D)

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Mark Question:
Answer:

D


User Votes:
A
50%
B 1 votes
50%
C
50%
D 1 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 12

Which two options are core Node.js modules?
Choose 2 answers

  • A. worker
  • B. isotream
  • C. exception
  • D. http
Mark Question:
Answer:

B, D


User Votes:
A
50%
B 1 votes
50%
C 1 votes
50%
D 2 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 13

Refer to the code below:

What is the value of result after line 10 executes?

  • A. Error: myFather.job is not a function
  • B. John Developer
  • C. undefined Developer
  • D. John undefined
Mark Question:
Answer:

B


User Votes:
A
50%
B 1 votes
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 14

Refer to the code below:

Which value can a developer expect when referencing country,capital,cityString?

  • A. 'London'
  • B. undefined
  • C. An error
  • D. 'NaN'
Mark Question:
Answer:

D


User Votes:
A
50%
B
50%
C
50%
D 1 votes
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 15

Given the code below:

Which method can be used to provide a visual representation of the list of users and to allow sorting
by the name or email attribute?

  • A. console.group(usersList) ;
  • B. console.table(usersList) ;
  • C. console.info(usersList) ;
  • D. console.groupCol lapsed (usersList) ;
Mark Question:
Answer:

A


User Votes:
A 1 votes
50%
B 1 votes
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
hagamablabla
7 months ago

https://developer.mozilla.org/en-US/docs/Web/API/console/table_static

To page 2