Salesforce JavaScript Developer I Practice Exams
Last updated on Nov 16,2026- Exam Code: JavaScript Developer I
- Exam Name: Salesforce Certified JavaScript Developer I
- Certification Provider: Salesforce
- Latest update: Nov 16,2026
developer creates a new web server that uses Node.js. It imports a server library that uses events and callbacks for handling server functionality.
The server library is imported with require and is made available to the code by a variable named server. The developer wants to log any issues that the server has while booting up.
Given the code and the information the developer has, which code logs an error at boost with an event?
- A . Server.catch ((server) => {
console.log(‘ERROR’, error);
}); - B . Server.error ((server) => {
console.log(‘ERROR’, error);
}); - C . Server.on (‘error’, (error) => {
console.log(‘ERROR’, error);
}); - D . Try{
server.start(); } catch(error) { console.log(‘ERROR’, error);
}
Refer to HTML below:
<p> The current status of an Order: <span id =”status”> In Progress </span> </p>.
Which JavaScript statement changes the text ‘In Progress’ to ‘Completed’?
- A . document.getElementById(“status”).Value = ’Completed’ ;
- B . document.getElementById(“#status”).innerHTML = ’Completed’ ;
- C . document.getElementById(“status”).innerHTML = ’Completed’ ;
- D . document.getElementById(“.status”).innerHTML = ’Completed’ ;
Refer to the code snippet:
Function getAvailabilityMessage(item) {
If (getAvailability(item)){
Var msg =”Username available”;
}
Return msg;
}
A developer writes this code to return a message to user attempting to register a new username. If the username is available, variable.
What is the return value of msg hen getAvailabilityMessage (“newUserName” ) is executed and getAvailability(“newUserName”) returns false?
- A . “Username available”
- B . “newUserName”
- C . “Msg is not defined”
- D . undefined
developer is trying to convince management that their team will benefit from using
Node.js for a backend server that they are going to create. The server will be a web server that handles API requests from a website that the teamhas already built using HTML, CSS, and JavaScript.
Which three benefits of Node.js can the developer use to persuade their manager? Choose 3 answers:
- A . Installs with its own package manager to install and manage third-party libraries.
- B . Ensures stability with one major release every few years.
- C . Performs a static analysis on code before execution to look for runtime errors.
- D . Executes server-side JavaScript code to avoid learning a new language.
- E . Uses non-blocking functionality for performant requesthandling .
Given the code below:
Which three code segments result in a correct conversion from number to string? Choose 3 answers
- A . let strValue = numValue. toString();
- B . let strValue = * * 4 numValue;
- C . let strValue = numValue.toText ();
- D . let scrValue = String(numValue);
- E . let strValue = (String)numValue;
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 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.
- 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().
Given the following code:
Counter = 0;
const logCounter = () => {
console.log(counter);
);
logCounter();
setTimeout(logCOunter, 1100);
setInterval(() => {
Counter++
logCounter();
}, 1000);
What is logged by the first four log statements?
- A . 0012
- B . 0123
- C . 0112
- D . 0122
Refer to the code below
let inArray = [[1,2],[3,4,5]];
which two statements results in the array [1,2,3,4,5]?
choose 2 answer
- A . [ ].concat(…inArray);
- B . [ ].concat.apply(inArray,[ ]);
- C . [ ].concat([…inArray])
- D . [ ].concat.apply([ ],inArray);
Refer to the following object:
const cat ={
firstName: ‘Fancy’,
lastName: ‘ Whiskers’,
Get fullName() {
return this.firstName + ‘ ‘ + this.lastName;
}
};
How can a developer access the fullName property for cat?
- A . cat.fullName
- B . cat.fullName()
- C . cat.get.fullName
- D . cat.function.fullName()
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 ()