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

JavaScript-Developer-I Leak Questions

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

Question 25

Function to test:

01 const sum3 = (arr) = > {

02 if (!arr.length) return 0;

03 if (arr.length === 1) return arr[0];

04 if (arr.length === 2) return arr[0] + arr[1] ;

05 return arr[0] + arr[1] + arr[2];

06 };

Which two assert statements are valid tests for this function?

Options:

A.

console.assert(sum3([1, ' 2 ' ]) == 12);

B.

console.assert(sum3([ ' hello ' , 2, 3, 4]) === NaN);

C.

console.assert(sum3([-3, 2]) === -1);

D.

console.assert(sum3([0]) === 0);

Question 26

Refer to the following object:

const dog = {

firstName: ' Beau ' ,

lastName: ' Boo ' ,

get fullName() {

return this.firstName + ' ' + this.lastName;

}

};

How can a developer access the fullName property for dog?

Options:

A.

dog.fullName

B.

dog.fullName()

C.

dog.get.fullName

D.

dog.function.fullName()

Question 27

Given the following code:

01 let x = null;

02 console.log(typeof x);

What is the output of line 02?

Options:

A.

" object "

B.

" undefined "

C.

" x "

D.

" null "

Question 28

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 '