New Year Special 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: best70

JavaScript-Developer-I Salesforce Certified JavaScript Developer I (SU24) Questions and Answers

Questions 4

Refer to the code snippet:

Function getAvailabilityMessage(item) {

If (getAvailability(item)){

Var msg =”Username available”;

}

Return msg;

}

A developer writes this code to return a message to user attempting to register a new

username. If the username is available, variable.

What is the return value of msg hen getAvailabilityMessage (“newUserName” ) is

executed and getAvailability(“newUserName”) returns false?

Options:

A.

“Username available”

B.

“newUserName”

C.

“Msg is not defined”

D.

undefined

Buy Now
Questions 5

Given two expressions var1 and var2. What are two valid ways to return the logical AND

of the two expressions and ensure it is data type Boolean ?

Choose 2 answers:

Options:

A.

Boolean(var1 && var2)

B.

var1 && var2

C.

var1.toBoolean() && var2toBoolean()

D.

Boolean(var1) && Boolean(var2)

Buy Now
Questions 6

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?

Options:

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.

Buy Now
Questions 7

Given the code below:

Which method can be used to provide a visual representation of the list of users and to allow sorting by the name or email attribute?

Options:

A.

console.group(usersList) ;

B.

console.table(usersList) ;

C.

console.info(usersList) ;

D.

console.groupCol lapsed (usersList) ;

Buy Now
Questions 8

Given the JavaScript below:

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

Options:

A.

'yellow' : null

B.

null : 'yellow’

C.

'none1 : "yellow’

D.

'yellow : 'none'

Buy Now
Questions 9

Refer to the code below:

const car = {

price:100,

getPrice:function(){

return this.price;

}

};

const customCar = Object.create(car);

customCar.price = 70;

delete customCar.price;const result = customCar.getPrice();

What is the value of result after the code executes?

Options:

A.

100

B.

undefined

C.

null

D.

70

Buy Now
Questions 10

Which statement accurately describes an aspect of promises?

Options:

A.

Arguments for the callback function passed to .then() are optional.

B.

In a.then() function, returning results is not necessary since callbacks will catch the result of a previous promise.

C.

.then() cannot be added after a catch.

D.

.then() manipulates and returns the original promise.

Buy Now
Questions 11

Given the code below:

const copy = JSON.stringify([ new String(‘ false ’), new Bollean( false ), undefined ]);

What is the value of copy?

Options:

A.

-- [ \”false\” , { } ]--

B.

-- [ false, { } ]--

C.

-- [ \”false\” , false, undefined ]--

D.

-- [ \”false\” ,false, null ]--

Buy Now
Questions 12

Refer to the code below:

01 let car1 = new promise((_, reject) =>

02 setTimeout(reject, 2000, “Car 1 crashed in”));

03 let car2 = new Promise(resolve => setTimeout(resolve, 1500, “Car 2

completed”));

04 let car3 = new Promise(resolve => setTimeout (resolve, 3000, “Car 3

Completed”));

05 Promise.race([car1, car2, car3])

06 .then(value => (

07 let result = $(value) the race. `;

08 ))

09 .catch( arr => (

10 console.log(“Race is cancelled.”, err);

11 ));

What is the value of result when Promise.race executes?

Options:

A.

Car 3 completed the race.

B.

Car 1 crashed in the race.

C.

Car 2 completed the race.

D.

Race is cancelled.

Buy Now
Questions 13

Which statement can a developer apply to increment the browser's navigation history without a page refresh?

Which statement can a developer apply to increment the browser's navigation history without a page refresh?

Options:

A.

window.history.pushState(newStateObject);

B.

window.history.pushStare(newStateObject, ' ', null);

C.

window.history.replaceState(newStateObject,' ', null);

D.

window.history.state.push(newStateObject);

Buy Now
Questions 14

Refer to the string below:

const str = 'Salesforce';

Which two statements result in the word 'Sales'?

Choose 2 answers

Options:

A.

str.substr(1, 5);

B.

str.substr (0, 5);

C.

str.substring (1, 5);

D.

str.substring (0, 5);

Buy Now
Questions 15

Refer to the code below:

function changeValue(param) {

Param =5;

}

Let a =10;

Let b =5;

changeValue(b);

Const result = a+ “ - ”+ b;

What is the value of result when code executes?

Options:

A.

10 -10

B.

5 -5

C.

5 - 10

D.

10 - 5

Buy Now
Questions 16

Given code below:

setTimeout (() => (

console.log(1);

). 0);

console.log(2);

New Promise ((resolve, reject )) = > (

setTimeout(() => (

reject(console.log(3));

). 1000);

)).catch(() => (

console.log(4);

));

console.log(5);

What is logged to the console?

Options:

A.

2 1 4 3 5

B.

2 5 1 3 4

C.

1 2 4 3 5

D.

1 2 5 3 4

Buy Now
Questions 17

A developer is wondering whether to use, Promise.then or Promise.catch, especially

when a Promise throws an error?

Which two promises are rejected?

Which 2 are correct?

Options:

A.

Promise.reject(‘cool error here’).then(error => console.error(error));

B.

Promise.reject(‘cool error here’).catch(error => console.error(error));

C.

New Promise((resolve, reject) => (throw ‘cool error here’}).catch(error =>

console.error(error)) ;

D.

New Promise(() => (throw ‘cool error here’}).then(null, error => console.error(error)));

Buy Now
Questions 18

Which code statement below correctly persists an objects in local Storage ?

Options:

A.

const setLocalStorage = (storageKey, jsObject) => {

window.localStorage.setItem(storageKey, JSON.stringify(jsObject));

}

B.

const setLocalStorage = ( jsObject) => {

window.localStorage.connectObject(jsObject));

}

C.

const setLocalStorage = ( jsObject) => {

window.localStorage.setItem(jsObject);

}

D.

const setLocalStorage = (storageKey, jsObject) => {

window.localStorage.persist(storageKey, jsObject);

}

Buy Now
Questions 19

A developer is setting up a Node,js server and is creating a script at the root of the source code, index,js, that will start the server when executed. The developer declares a variable that needs the folder location that the code executes from.

Which global variable can be used in the script?

Options:

A.

window.location

B.

_filename

C.

_dirname

D.

this.path

Buy Now
Questions 20

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

Buy Now
Questions 21

A developer wants to create an object from a function in the browser using the code below.

What happens due to the lack of the mm keyword on line 02?

Options:

A.

window.name is assigned to 'hello' and the variable = remains undefined.

B.

window.m Is assigned the correct object.

C.

The m variable is assigned the correct object but this.name remains undefined.

D.

The m variable is assigned the correct object.

Buy Now
Questions 22

A developer has a formatName function that takes two arguments, firstName and lastName and returns a string. They want to schedule the

function to run once after five seconds.

What is the correct syntax to schedule this function?

Options:

A.

setTimeout (formatName(), 5000, "John", "BDoe");

B.

setTimeout (formatName('John', ‘'Doe'), 5000);

C.

setTimout(() => { formatName("John', 'Doe') }, 5000);

D.

setTimeout ('formatName', 5000, 'John", "Doe');

Buy Now
Questions 23

What are two unique features of functions defined with a fat arrow as compared to normal function definition?

Choose 2 answers

Options:

A.

The function generated its own this making it useful for separating the function’s scope from its enclosing scope.

B.

The function receives an argument that is always in scope, called parentThis, which is the enclosing lexical scope. C. If the function has a single expression in the function body, the expression will be evaluated and implicit returned.

C.

The function uses the this from the enclosing scope.

Buy Now
Questions 24

At Universal Containers, every team has its own way of copying JavaScript objects. The code snippet shows an Implementation from one team:

What is the output of the code execution?

Options:

A.

Hello John Doe

B.

Hello Dan

C.

Hello Dan Doe

D.

SyntaxError: Unexpected token in JSON

Buy Now
Questions 25

Which two options are core Node.js modules?

Choose 2 answers

Options:

A.

worker

B.

isotream

C.

exception

D.

http

Buy Now
Questions 26

developer is trying to convince management that their team will benefit from using

Node.js for a backend server that they are going to create. The server will be a web server that

handles API requests from a website that the team has already built using HTML, CSS, and

JavaScript.

Which three benefits of Node.js can the developer use to persuade their manager?

Choose 3 answers:

Options:

A.

Installs with its own package manager to install and manage third-party libraries.

B.

Ensures stability with one major release every few years.

C.

Performs a static analysis on code before execution to look for runtime errors.

D.

Executes server-side JavaScript code to avoid learning a new language.

E.

Uses non-blocking functionality for performant request handling .

Buy Now
Questions 27

Refer to the following array:

Let arr = [ 1,2, 3, 4, 5];

Which three options result in x evaluating as [3, 4, 5] ?

Choose 3 answers.

Options:

A.

Let x= arr.filter (( a) => (a<2));

B.

Let x= arr.splice(2,3);

C.

Let x= arr.slice(2);

D.

Let x= arr.filter((a) => ( return a>2 ));

E.

Let x = arr.slice(2,3);

Buy Now
Questions 28

A team that works on a big project uses npm to deal with projects dependencies.

A developer added a dependency does not get downloaded when they execute npm

install.

Which two reasons could be possible explanations for this?

Choose 2 answers

Options:

A.

The developer missed the option --add when adding the dependency.

B.

The developer added the dependency as a dev dependency, and

NODE_ENV

Is set to production.

C.

The developer missed the option --save when adding the dependency.

D.

The developer added the dependency as a dev dependency, and

NODE_ENV is set to production.

Buy Now
Questions 29

Given the code below:

01 function GameConsole (name) {

02 this.name = name;

03 }

04

05 GameConsole.prototype.load = function(gamename) {

06 console.log( ` $(this.name) is loading a game : $(gamename) …`);

07 )

08 function Console 16 Bit (name) {

09 GameConsole.call(this, name) ;

10 }

11 Console16bit.prototype = Object.create ( GameConsole.prototype) ;

12 //insert code here

13 console.log( ` $(this.name) is loading a cartridge game : $(gamename) …`);

14 }

15 const console16bit = new Console16bit(‘ SNEGeneziz ’);

16 console16bit.load(‘ Super Nonic 3x Force ’);

What should a developer insert at line 15 to output the following message using the

method ?

> SNEGeneziz is loading a cartridge game: Super Monic 3x Force . . .

Options:

A.

Console16bit.prototype.load(gamename) = function() {

B.

Console16bit.prototype.load = function(gamename) {

C.

Console16bit = Object.create(GameConsole.prototype).load = function

(gamename) {

D.

Console16bit.prototype.load(gamename) {

Buy Now
Questions 30

Refer to the code below:

const event = new CustomEvent(

//Missing Code

);

obj.dispatchEvent(event);

A developer needs to dispatch a custom event called update to send information about

recordId.

Which two options could a developer insert at the placeholder in line 02 to achieve this?

Choose 2 answers

Options:

A.

‘Update’ , (

recordId : ‘123abc’

(

B.

‘Update’ , ‘123abc’

C.

{ type : ‘update’, recordId : ‘123abc’ }

D.

‘Update’ , {

Details : {

recordId : ‘123abc’

}

}

Buy Now
Questions 31

A developer creates an object where its properties should be immutable and prevent

properties from being added or modified.

Which method should be used to execute this business requirement ?

Options:

A.

Object.const()

B.

Object.eval()

C.

Object.lock()

D.

Object.freeze()

Buy Now
Questions 32

Refer to the code below

let inArray = [[1,2],[3,4,5]];

which two statements results in the array [1,2,3,4,5]?

choose 2 answer

Options:

A.

[ ].concat(...inArray);

B.

[ ].concat.apply(inArray,[ ]);

C.

[ ].concat([...inArray])

D.

[ ].concat.apply([ ],inArray);

Buy Now
Questions 33

Given the requirement to refactor the code above to JavaScript class format, which class

definition is correct?

A)

B)

C)

D)

Options:

Buy Now
Exam Name: Salesforce Certified JavaScript Developer I (SU24)
Last Update: Dec 21, 2024
Questions: 215

PDF + Testing Engine

$140

Testing Engine

$105

PDF (Q&A)

$90