Summer Certification Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: force70

Pass the Salesforce Salesforce Developer JavaScript-Developer-I Questions and answers with CertsForce

Viewing page 2 out of 5 pages
Viewing questions 11-20 out of questions
Questions # 11:

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


Expert Solution
Questions # 12:

Given a value, which two options can a developer use to detect if the value is NaN?

Options:

A.

value === Number.NaN


B.

value == NaN


C.

isNaN(value)


D.

Object.is(value, NaN)


Expert Solution
Questions # 13:

Given the code below:

01 setTimeout(() = > {

02 console.log(1);

03 }, 1100);

04 console.log(2);

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

06 setTimeout(() = > {

07 reject(console.log(3));

08 }, 1000);

09 }).catch(() = > {

10 console.log(4);

11 });

12 console.log(5);

What is logged to the console?

Options:

A.

25341


B.

12435


C.

12534


D.

21435


Expert Solution
Questions # 14:

Given the JavaScript below:

01 function filterDOM(searchString){

02 const parsedSearchString = searchString & & searchString.toLowerCase();

03 document.querySelectorAll( ' .account ' ).forEach(account = > {

04 const accountName = account.innerHTML.toLowerCase();

05 account.style.display = accountName.includes(parsedSearchString) ? /* Insert code here */;

06 });

07 }

Which code should replace the placeholder comment on line 05 to hide accounts that do not match the search string?

Options:

A.

' block ' : ' none '


B.

' hidden ' : ' visible '


C.

' visible ' : ' hidden '


D.

' none ' : ' block '


Expert Solution
Questions # 15:

JavaScript:

01 function Tiger() {

02 this.type = ' Cat ' ;

03 this.size = ' large ' ;

04 }

05

06 let tony = new Tiger();

07 tony.roar = () = > {

08 console.log( ' They\ ' re great! ' );

09 };

10

11 function Lion() {

12 this.type = ' Cat ' ;

13 this.size = ' large ' ;

14 }

15

16 let leo = new Lion();

17 // Insert code here

18 leo.roar();

Which two statements could be inserted at line 17 to enable line 18?

Options:

A.

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


B.

Object.assign(leo, tony);


C.

Object.assign(leo, Tiger);


D.

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


Expert Solution
Questions # 16:

static delay = async delay = > {

return new Promise(resolve = > {

setTimeout(resolve, delay);

});

};

static asyncCall = async () = > {

await delay(1000);

console.log(1);

};

console.log(2);

asyncCall();

console.log(3);

Assume delay and asyncCall are in scope as functions.

What is logged to the console?

Options:

A.

1 2 3


B.

1 3 2


C.

2 1 3


D.

2 3 1


Expert Solution
Questions # 17:

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;

}

}


Expert Solution
Questions # 18:

let sampleText = " The quick brown fox jumps " ;

Which three expressions return true for a substring?

Options:

A.

sampleText.includes( ' fox ' );


B.

sampleText.indexOf( ' quick ' ) > -1;


C.

sampleText.indexOf( ' fox ' ) !== -1;


D.

sampleText.include( ' fox ' ) !== -1;


E.

sampleText.indexOf( ' Quick ' ) !== -1;


Expert Solution
Questions # 19:

A developer has an isDeg function that takes one argument, pts. They want to schedule the function to run every minute.

What is the correct syntax for scheduling this function?

Options:

A.

setInterval(isDeg( ' cat ' ), 60000);


B.

setInterval(isDeg, 60000, ' cat ' );


C.

setTimeout(isDeg, 60000, ' cat ' );


D.

setTimeout(isDeg( ' cat ' ), 60000);


Expert Solution
Questions # 20:

Given the code below:

01 function Person() {

02 this.firstName = ' John ' ;

03 }

04

05 Person.proto = {

06 job: x = > ' Developer '

07 });

08

09 const myFather = new Person();

10 const result = myFather.firstName + ' ' + myFather.job();

What is the value of result when line 10 executes?

Options:

A.

Error: myFather.job is not a function


B.

undefined Developer


C.

John Developer


D.

John undefined


Expert Solution
Viewing page 2 out of 5 pages
Viewing questions 11-20 out of questions