Labour Day Special - Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: top65certs

Download Full Version JavaScript-Developer-I Salesforce Exam

Salesforce Certified JavaScript Developer I (SP23) Questions and Answers

Question 29

Refer to the following code:

Let sampleText = ‘The quick brown fox jumps’;

A developer needs to determine if a certain substring is part of a string.

Which three expressions return true for the given substring ?

Choose 3 answers

Options:

A.

sampleText.includes(‘fox’);

B.

sampleText.includes(‘ quick ’, 4);

C.

sampleText.includes(‘ Fox ’, 3)

D.

sampleText.includes(‘ fox ’);

E.

sampleText.includes(‘ quick ’) !== -1;

Question 30

Cloud Kicks has a class to represent items for sale in an online store, as shown below:

Class Item{

constructor (name, price){

this.name = name;

this.price = price;

}

formattedPrice(){

return ‘s’ + String(this.price);}}

A new business requirement comes in that requests a ClothingItem class that should have all of

the properties and methods of the Item class but will also have properties that are specific to

clothes.

Which line of code properly declares the clothingItem class such that it inherits from

Item?

Options:

A.

Class ClothingItem implements Item{

B.

Class ClothingItem {

C.

Class ClothingItem super Item {

D.

Class ClothingItem extends Item {

Question 31

developer creates a new web server that uses Node.js. It imports a server library that

uses events and callbacks for handling server functionality.

The server library is imported with require and is made available to the code by a

variable named server. The developer wants to log any issues that the server has while booting

up.

Given the code and the information the developer has, which code logs an error at boost

with an event?

Options:

A.

Server.catch ((server) => {

console.log(‘ERROR’, error);

});

B.

Server.error ((server) => {

console.log(‘ERROR’, error);

});

C.

Server.on (‘error’, (error) => {

console.log(‘ERROR’, error);

});

D.

Try{

server.start();

} catch(error) {

console.log(‘ERROR’, error);

}

Question 32

A test has a dependency on database.query. During the test the dependency is replaced

with an object called database with the method, query, that returns an array. The

developer needs to verify how many times the method was called and the arguments

used each time.

Which two test approaches describe the requirement?

Choose 2 answers

Options:

A.

Integration

B.

Black box

C.

White box

D.

Mocking