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
Refer to the code below:
Let car1 = new Promise((_, reject) =>
setTimeout(reject, 2000, “car 1 crashed in” =>
Let car2 =new Promise(resolve => setTimeout(resolve, 1500, “car 2 completed”)
Let car3 =new Promise(resolve =>setTimeout(resolve, 3000, “car 3 completed”)
Promise.race(( car1, car2, car3))
.then (value => (
Let result = ‘$(value) the race.’;)}
.catch(arr => {
console.log(“Race is cancelled.”, err);
});
What is the value of result when Promise.race executes?
- A . Car3 completes the race
- B . Car 2 completed the race.
- C . Car 1 crashed in the race.
- D . Race is cancelled.
Universal Containers (UC) just launched anew landing page, but users complain that the website is slow. A developer found some functions any that might cause this problem. To verify this, the developer decides to execute everything and log the time each of these three suspicious functions consumes.
01 console.time(‘Performance’);
02
03 maybeAHeavyFunction();
04
05 thisCouldTakeTooLong();
06
07 orMaybeThisOne();
08
09 console.endTime(‘Performance’);
Which function can the developer use to obtain the time spent by every one of the three functions?
- A . console. timeLog ()
- B . console.timeStamp ()
- C . console.trace()
- D . console.getTime ()
A developer implements a function that adds a few values.
Function sum(num) {
If (num == undefined) {
Num =0;
}
Return function( num2, num3){
If (num3 ===undefined) {
Num3 =0 ;
}
Return num + num2 + num3;
}
}
Which three options can the developer invoke for this function to get a return value of 10? Choose 3 answers
- A . Sum () (20)
- B . Sum (5, 5) ()
- C . sum() (5, 5)
- D . sum(5)(5)
- E . sum(10) ()
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 ’) 😉
Given the code below:
const delay = sync delay => {
Return new Promise ((resolve, reject) => {
setTimeout (resolve,delay);});};
const callDelay =async () => {
const yup =await delay (1000);
console.log (1);
What is logged to the console?
- A . 123
- B . 132
- C . 213
- D . 231
Refer to the code below:
Const resolveAfterMilliseconds = (ms) => Promise.resolve (setTimeout ((=> console.log(ms), ms ));
Const aPromise = await resolveAfterMilliseconds(500);
Const bPromise = await resolveAfterMilliseconds(500);
Await aPromise, wait bPromise;
What is the result of running line 05?
- A . aPromise and bPromise run sequentially.
- B . Neither aPromise or bPromise runs.
- C . aPromise and bPromise run in parallel.
- D . Only aPromise runs.
developer wants to use a module named universalContainersLib and them callfunctions
from it.
How should a developer import every function from the module and then call the functions foo and bar?
- A . import * ad lib from ‘/path/universalContainersLib.js’;lib.foo();lib.bar();
- B . import (foo, bar) from ‘/path/universalContainersLib.js’;foo();bar();
- C . import all from ‘/path/universalContaineraLib.js’;universalContainersLib.foo();universalContainersLib.bar();
- D . import * from ‘/path/universalContaineraLib.js’;universalContainersLib.foo();universalContainersLib.bar();
A developer has a web server running with Node.js. The command to start the web server is node server.js. The web server started having latency issues. Instead of a one second turnaround for web requests, the developer now sees a five second turnaround.
Which command can the web developer run to see what the module is doing during the latency period?
- A . NODE_DEBUG=true node server.js
- B . DEBUG=http, https node server.js
- C . NODE_DEBUG=http,https node server.js
- D . DEBUG=true node server.js
A developer initiates a server with the file server,js and adds dependencies in the source codes package,json that are required to run the server.
Which command should the developer run to start the server locally?
- A . start server,js
- B . npm start server,js
- C . npm start
- D . node start
Which code change should be done for the console to log the following when ‘Click me!’ is clicked’

> Row log
> Table log
- A . Remove lines 13 and14
- B . Change line 10 to event.stopPropagation (false) ;
- C . Change line 14 to elem.addEventListener (‘click’, printMessage, true);
- D . Remove line 10