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

Exact2Pass Menu

Salesforce Certified JavaScript Developer (JS-Dev-101)

Last Update 4 hours ago Total Questions : 147

The Salesforce Certified JavaScript Developer (JS-Dev-101) content is now fully updated, with all current exam questions added 4 hours ago. Deciding to include JavaScript-Developer-I practice exam questions in your study plan goes far beyond basic test preparation.

You'll find that our JavaScript-Developer-I exam questions frequently feature detailed scenarios and practical problem-solving exercises that directly mirror industry challenges. Engaging with these JavaScript-Developer-I sample sets allows you to effectively manage your time and pace yourself, giving you the ability to finish any Salesforce Certified JavaScript Developer (JS-Dev-101) practice test comfortably within the allotted time.

Question # 31

Given:

const str = ' Salesforce ' ;

Which two statements result in ' Sales ' ?

A.

str.substring(0, 5);

B.

str.substring(1, 5);

C.

str.substr(0, 5);

D.

str.substr(1, 5);

Question # 32

Universal Containers (UC) just launched a new landing page, but users complain that the website is slow. A developer found some functions 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.

01 console.time( ' Performance ' );

02

03 maybeAHeavyFunction();

04

05 thisCouldTakeTooLong();

06

07 orMaybeThisOne();

08

09 console.endTime( ' Performance ' );

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

A.

console.timeLog()

B.

console.trace()

C.

console.timeStamp()

D.

console.getTime()

Question # 33

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?

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 # 34

A developer wants to use a module named universalContainerslib and then call functions from it. How should a developer import every function from the module and then call the functions foo and bar?

A.

import * as lib from ' /path/universalContainerslib.js ' ;

lib.foo();

lib.bar();

B.

import * from ' /path/universalContainerslib.js ' ;

universalContainerslib.foo();

universalContainerslib.bar();

C.

import all from ' /path/universalContainerslib.js ' ;

universalContainerslib.foo();

universalContainerslib.bar();

D.

import {foo, bar} from ' /path/universalContainerslib.js ' ;

foo();

bar();

Question # 35

Refer to the code below:

01 async function functionUnderTest(isOK) {

02 if (isOK) return ' OK ' ;

03 throw new Error( ' not OK ' );

04 }

Which assertion accurately tests the above code?

A.

console.assert(await functionUnderTest(true), ' OK ' )

B.

console.assert(await (functionUnderTest(true), ' not OK ' ))

C.

console.assert(functionUnderTest(true), ' OK ' )

D.

console.assert(await functionUnderTest(true), ' not OK ' )

Question # 36

A 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.

Which code logs an error at boot time with an event?

A.

server.error((error) = > {

console.log( ' ERROR ' , error);

});

B.

server.catch((error) = > {

console.log( ' ERROR ' , error);

});

C.

try {

server.start();

} catch(error) {

console.log( ' ERROR ' , error);

}

D.

server.on( ' error ' , (error) = > {

console.log( ' ERROR ' , error);

});

Question # 37

Refer to the code snippet:

01 function getAvailableilityMessage(item) {

02 if (getAvailableility(item)) {

03 var msg = " Username available " ;

04 }

05 return msg;

06 }

What is the return value of msg when getAvailableilityMessage( " newUserName " ) is executed and getAvailableility( " newUserName " ) returns false?

A.

" newUserName "

B.

" msg is not defined "

C.

undefined

D.

" Username available "

Question # 38

Which statement accurately describes the behavior of the async/await keywords?

A.

The associated function sometimes returns a promise.

B.

The associated function can only be called via asynchronous methods.

C.

The associated class contains some asynchronous functions.

D.

The associated function is asynchronous, but acts like synchronous code.

Question # 39

A developer creates a class that represents a news story based on the requirements that a Story should have a body, author, and view count. The code is shown below:

01 class Story {

02 // Insert code here

03 this.body = body;

04 this.author = author;

05 this.viewCount = viewCount;

06 }

07 }

Which statement should be inserted in the placeholder on line 02 to allow for a variable to be set to a new instance of a Story with the three attributes correctly populated?

A.

constructor() {

B.

super(body, author, viewCount) {

C.

function Story(body, author, viewCount) {

D.

constructor(body, author, viewCount) {

Question # 40

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?

A.

clearInterval(timerId);

B.

removeInterval(timerId);

C.

removeInterval(timedFunction);

D.

clearInterval(timedFunction);

Go to page: