Salesforce-JavaScript-Developer Practice Test

Salesforce Spring 25 Release -
Updated On 1-Jan-2026

221 Questions

Refer to the following code:
class Vehicle{
constructor(plate){
this.plate = plate;
}
}
class Truck extends Vehicle{
constructor(plate, weight){
//Missing code
this.weight = weight;
}
displayWeight(){
console.log(`The truck ${this.plate} has a weight of ${this.weight}lb.`);
}
}let myTruck = new Truck('123Ab',5000);
myTruck.displayWeight();
Which statement should be added to missing code for the code to display 'The truck 123AB
has a
weight of 5000lb.

A. super(plate)

B. super.plate = plate

C. Vehicle.plate = plate

D. this.plate = plate

A.   super(plate)

developer uses the code below to format a date.

After executing, what is the value of formattedDate?
A. 

A. May 10, 2020

B. June 10, 2020

C. October 05, 2020

D. November 05, 2020

B.   June 10, 2020

Refer to the following code:

Which two statement could be inserted at line 17 to enable the function call on line 18? Choose 2 answers

A. Object.assign (leo, tony);

B. Object.assign (leo. Tiger);

C. leo.roar = () => { console.log('They\'re pretty good!'); );

D. leo.prototype.roar = ( ) =>( console.log('They\'re pretty good!'); };

A.   Object.assign (leo, tony);
C.   leo.roar = () => { console.log('They\'re pretty good!'); );

Refer to the following code:

What is the value of output on line 11?

A.

[1, 2]

B.

[‘’foo’’, ‘’bar’’]

C.

[

D.

An error will occur due to the incorrect usage of the for…of statement on line 07.

D.   

An error will occur due to the incorrect usage of the for…of statement on line 07.



Refer to the code below:
for(let number =2 ; number <= 5 ; number += 1 ) {
// insert code statement here
}
The developer needs to insert a code statement in the location shown. The code statement has these requirements:
1. Does require an import
2. Logs an error when the boolean statement evaluates to false
3. Works in both the browser and Node.js
Which meet the requirements?

A. assert (number % 2 === 0);

B. console.error(number % 2 === 0);

C. console.debug(number % 2 === 0);

D. console.assert(number % 2 === 0);

B.   console.error(number % 2 === 0);

Salesforce-JavaScript-Developer Exam Questions - Home Previous
Page 7 out of 45 Pages