Summer Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 70track

Free Salesforce JavaScript-Developer-I Practice Exam with Questions & Answers | Set: 2

Questions 11

Refer to the code:

const pi = 3.1415926;

What is the data type of pi?

Options:
A.

Float

B.

Double

C.

Decimal

D.

Number

Salesforce JavaScript-Developer-I Premium Access
Questions 12

Refer to the code below:

01 let country = {

02 get capital() {

03 let city = Number( " London " );

04

05 return {

06 cityString: city.toString(),

07 }

08 }

09 }

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

Options:
A.

An error

B.

NaN

C.

undefined

D.

' London '

Questions 13

A developer implements a function that adds a few values.

function sum(num1, num2, num3) {

if (num3 === undefined) {

num3 = 0;

}

return num1 + num2 + num3;

}

Which three options can the developer invoke for this function to get a return value of 10?

Options:
A.

sum(5)(5);

B.

sum()(10);

C.

sum(5, 5, 0);

D.

sum(10, 0);

E.

sum(5, 2, 3);

Questions 14

A developer wants to catch any error that countSheep() may throw and pass it to handleError().

Which implementation is correct?

Options:
A.

try {

setTimeout(function() {

countSheep();

}, 1000);

}

catch (e) {

handleError(e);

}

B.

try {

countSheep();

} finally {

handleError(e);

}

C.

try {

countSheep();

} handleError(e) {

catch(e);

}

D.

setTimeout(function() {

try {

(Answer incomplete in option list.)

Questions 15

Refer to the code below (corrected to use a template literal on line 08):

01 let car1 = new Promise((_, reject) = >

02 setTimeout(reject, 2000, " Car 1 crashed in " )

03 );

04 let car2 = new Promise(resolve = >

05 setTimeout(resolve, 1500, " Car 2 completed " )

06 );

07 let car3 = new Promise(resolve = >

08 setTimeout(resolve, 3000, " Car 3 completed " )

09 );

10

11 Promise.race([car1, car2, car3])

12 .then(value = > {

13 let result = `${value} the race.`;

14 })

15 .catch(err = > {

16 console.log( " Race is cancelled. " , err);

17 });

What is the value of result when Promise.race executes?

Options:
A.

Car 3 completed the race.

B.

Car 2 completed the race.

C.

Race is cancelled.

D.

Car 1 crashed in the race.

Questions 16

Refer to the code below:

01 const addBy = ?

02 const addByEight = addBy(8);

03 const sum = addByEight(50);

Which two functions can replace line 01 and return 58 to sum?

Options:
A.

const addBy = function(num1) {

return function(num2) {

return num1 + num2;

}

}

B.

const addBy = function(num1) {

return num1 * num2;

}

C.

const addBy = (num1) = > num1 + num2;

D.

(Corrected for typing errors)

const addBy = (num1) = > {

return function(num2) {

return num1 + num2;

}

}

Questions 17

Which two implementations of utils.js support foo and bar?

Options:
A.

const foo = () = > { return ' foo ' ; };

const bar = () = > { return ' bar ' ; };

export { foo, bar };

B.

const foo = () = > { return ' foo ' ; };

const bar = () = > { return ' bar ' ; };

export default { foo, bar };

C.

import { foo, bar } from " ./helpers/utils.js " ;

export { foo, bar };

D.

export default class {

foo() { return ' foo ' ; }

bar() { return ' bar ' ; }

}

Questions 18

Refer to the HTML below:

< div id= " main " >

< ul >

< li > Leo < /li >

< li > Tony < /li >

< li > Tiger < /li >

< /ul >

< /div >

Which JavaScript statement results in changing " Leo " to " The Lion " ?

Options:
A.

document.querySelectorAll( ' #main #Leo ' ).innerHTML = ' The Lion ' ;

B.

document.querySelector( ' #main li:second-child ' ).innerHTML = ' The Lion ' ;

C.

document.querySelectorAll( ' #main li,Leo ' ).innerHTML = ' The Lion ' ;

D.

document.querySelector( ' #main li:nth-child(1) ' ).innerHTML = ' The Lion ' ;

Questions 19

Refer to the code below:

class Student {

constructor(name) {

this._name = name;

}

displayGrade() {

console.log(`${this._name} got 70% on test.`);

}

}

class GraduateStudent extends Student {

constructor(name) {

super(name);

this._name = " Graduate Student " + name;

}

displayGrade() {

console.log(`${this._name} got 100% on test.`);

}

}

let student = new GraduateStudent( " Jane " );

student.displayGrade();

What is the console output?

Options:
A.

Better student Jackie got 70% on test.

B.

Uncaught ReferenceError

C.

Graduate Student Jane got 100% on test.

D.

Jackie got 70% on test.

Questions 20

Given the code below:

01 function Person(name, email) {

02 this.name = name;

03 this.email = email;

04 }

05

06 const john = new Person( ' John ' , ' john@email.com ' );

07 const jane = new Person( ' Jane ' , ' jane@email.com ' );

08 const emily = new Person( ' Emily ' , ' emily@email.com ' );

09

10 let usersList = [john, jane, emily];

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?

Options:
A.

console.table(usersList);

B.

console.group(usersList);

C.

console.groupCollapsed(usersList);

D.

console.info(usersList);

Certification Provider: Salesforce
Exam Name: Salesforce Certified JavaScript Developer (JS-Dev-101)
Last Update: Jul 6, 2026
Questions: 147