New Year Sale Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: xmas50

Salesforce JavaScript-Developer-I - Salesforce Certified JavaScript Developer (JS-Dev-101)

Page: 6 / 7
Total 219 questions

Universal Containers (UC) just launched anew landing page, but users complain that the website is slow. A developer found some functions any that might cause this problem. To verify this, the developer decides to execute everything and log the time each of these three suspicious functions consumes.

Which function can the developer use to obtain the time spent by every one of the three functions?

A.

console. timeLog ()

B.

console.timeStamp ()

C.

console.trace()

D.

console.getTime ()

Which two code snippets showworking examples of a recursive function?

Choose 2 answers

A.

Let countingDown = function(startNumber) {If ( startNumber >0) {console.log(startNumber) ;return countingDown(startNUmber);} else {return startNumber;}};

B.

Function factorial ( numVar ) {If (numVar < 0) return;If ( numVar === 0 ) return 1;return numVar -1;

C.

Const sumToTen = numVar => {If (numVar < 0)Return;return sumToTen(numVar + 1)};

D.

Const factorial =numVar => {If (numVar < 0) return;If ( numVar === 0 ) return 1;returnnumVar * factorial ( numVar - 1 );};

Refer to the code below:

console.log(‘’start);

Promise.resolve(‘Success’) .then(function(value){

console.log(‘Success’);

});

console.log(‘End’);

What is the output after the code executes successfully?

A.

EndStartSuccess

B.

StartSuccessEnd

C.

StartEndSuccess

D.

SuccessStartEnd

Refer to the followingcode:

Refer to the code below:

Function Person(firstName, lastName, eyecolor) {

this.firstName =firstName;

this.lastName = lastName;

this.eyeColor = eyeColor;

}

Person.job = ‘Developer’;

const myFather = new Person(‘John’, ‘Doe’);

console.log(myFather.job);

What is the output after the code executes?

A.

ReferenceError: eyeColor is not defined

B.

ReferenceError: assignment to undeclared variable “Person”

C.

Developer

D.

Undefined

A test has a dependency on database. query. During the test, the dependency is replaced with an object called database with the method,

Calculator query, that returns an array. The developer does notneed to verify how many times the method has been called.

Which two test approaches describe the requirement?

Choose 2 answers

A.

White box

B.

Stubbing

C.

Black box

D.

Substitution

A developer wants to iterate through an array of objects and count the objects and count

the objects whose property value, name, starts with the letterN.

Const arrObj = [{“name” : “Zach”} , {“name” : “Kate”},{“name” : “Alise”},{“name” : “Bob”},{“name” :

“Natham”},{“name” : “nathaniel”}

Refer to the code snippet below:

01 arrObj.reduce(( acc, curr) => {

02 //missing line 02

02 //missing line 03

04 ). 0);

Which missing lines 02 and 03 return the correct count?

A.

Const sum = curr.startsWith(‘N’) ? 1: 0;Return acc +sum

B.

Const sum = curr.name.startsWith(‘N’) ? 1: 0;Return acc +sum

C.

Const sum = curr.startsWIth(‘N’) ? 1: 0;Return curr+ sum

D.

Const sum =curr.name.startsWIth(‘N’) ? 1: 0;Return curr+ sum

A class was written to represent items for purchase in an online store, and a secondclass

Representing items that are on sale at a discounted price. THe constructor sets the name to the

first value passed in. The pseudocode is below:

Class Item {

constructor(name, price) {

… // Constructor Implementation

}

}

Class SaleItem extends Item {

constructor (name, price, discount) {

...//Constructor Implementation

}

}

There is a new requirement for a developer to implement a description method that will return a

brief description for Item and SaleItem.

Let regItem =new Item(‘Scarf’, 55);

Let saleItem = new SaleItem(‘Shirt’ 80, -1);

Item.prototype.description = function () { return ‘This is a ’ + this.name;

console.log(regItem.description());

console.log(saleItem.description());

SaleItem.prototype.description = function () { return ‘This is a discounted ’ +

this.name; }

console.log(regItem.description());

console.log(saleItem.description());

What is the output when executing the code above ?

A.

This is a ScarfUncaught TypeError: saleItem.description is not a functionThis is aScarfThis is a discounted Shirt

B.

This is a ScarfThis is a ShirtThis is a ScarfThis is a discounted Shirt

C.

This is a ScarfThis is a ShirtThis is a discounted ScarfThis is a discounted Shirt

D.

This is aScarfUncaught TypeError: saleItem.description is not a functionThis is a ShirtThis is a did counted Shirt

Given the JavaScript below:

Which code should replace the placeholder comment on line 05 to highlight accounts that match the search string'

A.

'yellow' : null

B.

null : 'yellow’

C.

'none1 : "yellow’

D.

'yellow : 'none'

A developer has code that calculates a restaurant bill, but generates incorrect answers

while testing the code:

function calculateBill (items ) {

let total = 0;

total += findSubTotal(items);

total += addTax(total);

total += addTip(total);

return total;

}

Which option allows the developer to step into each function execution within calculateBill?

A.

Using the debugger command on line 05.

B.

Using the debugger command on line 03

C.

Calling the console.trace (total) method on line 03.

D.

Wrapping findSubtotal in a console.log() method.