Summer Certification Sale 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: save70

PDF JavaScript-Developer-I Study Guide

Salesforce Certified JavaScript Developer (JS-Dev-101) Questions and Answers

Question 17

Refer to the code below:

01 let timedFunction = () = > {

02 console.log( ' Timer called. ' );

03 };

04

05 let timerId = setInterval(timedFunction, 1000);

Which statement allows a developer to cancel the scheduled timed function?

Options:

A.

clearInterval(timerId);

B.

removeInterval(timerId);

C.

removeInterval(timedFunction);

D.

clearInterval(timedFunction);

Question 18

Refer to the code below:

01 new Promise((resolve, reject) = > {

02 const fraction = Math.random();

03 if (fraction > 0.5) reject( ' fraction > 0.5, ' + fraction);

04 resolve(fraction);

05 })

06 .then(() = > console.log( ' resolved ' ))

07 .catch((error) = > console.error(error))

08 .finally(() = > console.log( ' when am I called? ' ));

When does Promise.finally on line 08 get called?

Options:

A.

When rejected

B.

When resolved and settled

C.

When resolved

D.

When resolved or rejected

Question 19

01 function Animal(size, type) {

02 this.type = type || ' Animal ' ;

03 this.canTalk = false;

04 }

05

06 Animal.prototype.speak = function() {

07 if (this.canTalk) {

08 console.log( " It spoke! " );

09 }

10 };

11

12 let Pet = function(size, type, name, owner) {

13 Animal.call(this, size, type);

14 this.size = size;

15 this.name = name;

16 this.owner = owner;

17 }

18

19 Pet.prototype = Object.create(Animal.prototype);

20 let pet1 = new Pet();

Given the code above, which three properties are set for pet1?

Options:

A.

speak

B.

owner

C.

canTalk

D.

name

E.

type

Question 20

A developer imports:

import printPrice from ' /path/PricePrettyPrint.js ' ;

What must be true about printPrice for this import to work?

Options:

A.

printPrice must be a named export

B.

printPrice must be an all export

C.

printPrice must be the default export

D.

printPrice must be a multi export