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

Salesforce Certified JavaScript Developer I (SP23) Question and Answers

Salesforce Certified JavaScript Developer I (SP23)

Last Update Apr 25, 2024
Total Questions : 219

We are offering FREE JavaScript-Developer-I Salesforce exam questions. All you do is to just go and sign up. Give your details, prepare JavaScript-Developer-I free exam questions and then go for complete pool of Salesforce Certified JavaScript Developer I (SP23) test questions that will help you more.

JavaScript-Developer-I pdf

JavaScript-Developer-I PDF

$35  $99.99
JavaScript-Developer-I Engine

JavaScript-Developer-I Testing Engine

$42  $119.99
JavaScript-Developer-I PDF + Engine

JavaScript-Developer-I PDF + Testing Engine

$56  $159.99
Questions 1

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?

Options:

A.  

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

universalContainersLib. foo ()7

universalContainersLib.bar ();

B.  

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

foo():

bar()?

C.  

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

universalContainersLib.foo();

universalContainersLib.bar ();

D.  

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

lib.foo();

lib. bar ();

Discussion 0
Questions 2

Refer to the following code:

function test (val) {

If (val === undefined) {

return ‘Undefined values!’ ;

}

if (val === null) {

return ‘Null value! ’;

}

return val;

}

Let x;

test(x);

What is returned by the function call on line 13?

Options:

A.  

Undefined

B.  

Line 13 throws an error.

C.  

‘Undefined values!’

D.  

‘Null value!’

Discussion 0
Questions 3

Refer to the code below:

new Promise((resolve, reject) => {

const fraction = Math.random();

if( fraction >0.5) reject("fraction > 0.5, " + fraction);

resolve(fraction);

})

.then(() =>console.log("resolved"))

.catch((error) => console.error(error))

.finally(() => console.log(" when am I called?"));

When does Promise.finally on line 08 get called?

Options:

A.  

When rejected

B.  

When resolved and settled

C.  

When resolved

D.  

When resolved or rejected

Discussion 0
Questions 4

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?

Options:

A.  

ReferenceError: eyeColor is not defined

B.  

ReferenceError: assignment to undeclared variable “Person”

C.  

Developer

D.  

Undefined

Discussion 0
Questions 5

Refer to code below:

Const objBook = {

Title: ‘Javascript’,

};

Object.preventExtensions(objBook);

Const newObjBook = objBook;

newObjectBook.author = ‘Robert’;

What are the values of objBook and newObjBook respectively ?

Options:

A.  

[title: “javaScript”] [title: “javaScript”]

B.  

{author: “Robert”, title: “javaScript}

Undefined

C.  

{author: “Robert”, title: “javaScript}

{author: “Robert”, title: “javaScript}

D.  

{author: “Robert”}

{author: “Robert”, title: “javaScript}

Discussion 0
Questions 6

Given the code below:

const delay = sync delay => {

Return new Promise((resolve, reject) => {

setTimeout (resolve, delay);});};

const callDelay =async () =>{

const yup =await delay(1000);

console.log(1);

What is logged to the console?

Options:

A.  

1 2 3

B.  

1 3 2

C.  

2 1 3

D.  

2 3 1

Discussion 0
Questions 7

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 not need to verify how many times the method has been called.

Which two test approaches describe the requirement?

Choose 2 answers

Options:

A.  

White box

B.  

Stubbing

C.  

Black box

D.  

Substitution

Discussion 0
Questions 8

Given the following code:

What is the output of line 02?

Options:

A.  

"null"

B.  

"x-

C.  

"undefined" 0

D.  

'object"

Discussion 0
Questions 9

Refer to the code below:

What is the value of result when the code executes?

Options:

A.  

10-10

B.  

5-5

C.  

10-5

D.  

5-10

Discussion 0
Questions 10

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

Discussion 0
Questions 11

Refer to the following object:

const cat ={

firstName: ‘Fancy’,

lastName: ‘ Whiskers’,

Get fullName() {

return this.firstName + ‘ ‘ + this.lastName;

}

};

How can a developer access the fullName property for cat?

Options:

A.  

cat.fullName

B.  

cat.fullName()

C.  

cat.get.fullName

D.  

cat.function.fullName()

Discussion 0
Questions 12

At Universal Containers, every team has its own way of copying JavaScript objects. The

code

Snippet shows an implementation from one team:

Function Person() {

this.firstName = “John”;

this.lastName = ‘Doe’;

This.name =() => (

console.log(‘Hello $(this.firstName) $(this.firstName)’);

)}

Const john = new Person ();

Const dan = JSON.parse(JSON.stringify(john));

dan.firstName =’Dan’;

dan.name();

What is the Output of the code execution?

Options:

A.  

Hello Dan Doe

B.  

Hello John DOe

C.  

TypeError: dan.name is not a function

D.  

TypeError: Assignment to constant variable.

Discussion 0
Questions 13

Refer the code below.

x=3.14;

function myfunction() {

"use strict";

y=x;

}

z=x;

myFunction();

Options:

Discussion 0
Questions 14

A developer has the function, shown below, that is called when a page loads.

function onload() {

console.log(“Page has loaded!”);

}

Where can the developer see the log statement after loading the page in the browser?

Options:

A.  

Terminal running the web server.

B.  

Browser performance toots

C.  

Browser javaScript console

D.  

On the webpage.

Discussion 0
Questions 15

Refer to the following code:

Which statement should be added to line 09 for the code to display. The boat has a capacity of 10 people?

Options:

A.  

super.size = size;

B.  

ship.size size;

C.  

super (size);

D.  

this.size = size;

Discussion 0
Questions 16

Refer to the code below:

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

Which two statements result in the array [1, 2, 3, 4, 5] ?

Choose 2 answers

Options:

A.  

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

B.  

[ ]. Concat (... inArray);

C.  

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

D.  

[ ]. concat ( [ ….inArray ] );

Discussion 0
Questions 17

Which three browser specific APIs are available for developers to persist data between page loads ?

Choose 3 answers

Options:

A.  

IIFEs

B.  

indexedDB

C.  

Global variables

D.  

Cookies

E.  

localStorage.

Discussion 0
Questions 18

Given the following code:

Let x =(‘15’ + 10)*2;

What is the value of a?

Options:

A.  

3020

B.  

1520

C.  

50

D.  

35

Discussion 0
Questions 19

In the browser, the window object is often used to assign variables that require the broadest scope in an application Node.js application does not have access to the window object by default.

Which two methods are used to address this ?

Choose 2 answers

Options:

A.  

Use the document object instead of the window object.

B.  

Assign variables to the global object.

C.  

Create a new window object in the root file.

D.  

Assign variables to module.exports and require them as needed.

Discussion 0
Questions 20

A developer is debugging a web server that uses Node.js The server hits a runtimeerror

every third request to an important endpoint on the web server.

The developer added a break point to the start script, that is at index.js at he root of the

server’s source code. The developer wants to make use of chrome DevTools to debug.

Which command can be run to access DevTools and make sure the breakdown is hit ?

Options:

A.  

node -i index.js

B.  

Node --inspect-brk index.js

C.  

Node inspect index.js

D.  

Node --inspect index.js

Discussion 0
Questions 21

A developer at Universal Containers is creating their new landing page based on HTML, CSS, and JavaScript.

To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed when the webpage is fully loaded (HTML content and all related files), in order to do some custom initializations.

Which implementation should be used to call Fe:s:-a;::eHec5;te::.-.ter.: based on the business requirement above?

Options:

A.  

Add a listener to the window object to handle the DOMContentLoaded event

B.  

Add a handler to the personalizeWebsiteContent script to handle the load event

C.  

Add a listener to the window object to handle the lead event

D.  

Add a handler to the personalizeWebsiteContent script to handle the DOMContentLoaded event

Discussion 0
Questions 22

Given the following code:

document.body.addEventListener(‘ click ’, (event) => {

if (/* CODE REPLACEMENT HERE */) {

console.log(‘button clicked!’);

)

});

Which replacement for the conditional statement on line 02 allows a developer to

correctly determine that a button on page is clicked?

Options:

A.  

Event.clicked

B.  

e.nodeTarget ==this

C.  

event.target.nodeName == ‘BUTTON’

D.  

button.addEventListener(‘click’)

Discussion 0
Questions 23

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

Discussion 0
Questions 24

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)));

Discussion 0
Questions 25

A developer has the following array of hourly wages:

Let arr = (8, 5, 9, 75, 11, 25, 7, 75, , 13, 25);

For workers making less than $10 an hour rate should be multiple by 1.25 and returned in a new array.

How should the developer implement the request?

Options:

A.  

let arrl = arr.filter((val) => val < 10).map((num) -> num = 1.25);

B.  

let arrl = arr .rr.acArray ((val) => ( val < 10 )) ,map((num) => { num * 1.25 ));

C.  

let arrl = arr-map((num) => { return ran * 1.25 }).filter((val) -> { return val < 10));

D.  

let arrl = arr.filterBy((val) => val < 10 ).aapBy<(num) -> num = ..25 );

Discussion 0
Questions 26

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.

Discussion 0
Questions 27

Given the following code:

What will be the first four numbers logged?

Options:

A.  

0012

B.  

0112

C.  

0122

D.  

0123

Discussion 0
Questions 28

Refer to the expression below:

Let x = (‘1’ + 2) == (6 * 2);

How should this expression be modified to ensure that evaluates to false?

Options:

A.  

Let x = (‘1’ + ‘ 2’) == ( 6 * 2);

B.  

Let x = (‘1’ + 2) == ( 6 * 2);

C.  

Let x = (1 + 2) == ( ‘6’ / 2);

D.  

Let x = (1 + 2 ) == ( 6 / 2);

Discussion 0
Questions 29

Universal Containers (UC) just launched a new 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?

Options:

A.  

console. timeLog ()

B.  

console.timeStamp ()

C.  

console.trace()

D.  

console.getTime ()

Discussion 0
Questions 30

Refer to the code below:

Which replacement for the conditional statement on line 02 allows a developer to correctly determine

that a specific element, myElement on the page had been clicked?

Options:

A.  

event.target.id =='myElement'

Discussion 0
Questions 31

Refer to the code below:

let car1 = new Promise((_ ,reject)=> setTimeout(reject,2000,"Car1 crashed in"));

let car2 = new Promise(resolve => setTimeout(resolve,1500,"Car2 completed"));

let car3 = new Promise(resolve => setTimeout(resolve,3000,"Car3 completed"));

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

.then(value=>{

let result = `${value} the race.`;

}).catch(err=>{

console.log('Race is cancelled.',err);

});

What is the value of result when promise.race execues?

Options:

A.  

Car2 completed the race.

Discussion 0
Questions 32

Refer to the code below:

Let textValue = ’1984’;

Which code assignment shows a correct way to convert this string to an integer?

Options:

A.  

let numberValue = Number(textValue);

B.  

Let numberValue = (Number)textValue;

C.  

Let numberValue = textValue.toInteger();

D.  

Let numberValue = Integer(textValue);

Discussion 0
Questions 33

A developer at Universal Containers creates a new landing page based on HTML, CSS, and

JavaScript TO ensure that visitors have a good experience, a script named personaliseContext

needs to be executed when the webpage is fully loaded (HTML content and all related files ), in

order to do some custom initialization.

Which statement should be used to call personalizeWebsiteContent based on the above

business requirement?

Options:

A.  

document.addEventListener(‘’onDOMContextLoaded’, personalizeWebsiteContext);

B.  

window.addEventListener(‘load’,personalizeWebsiteContext);

C.  

window.addEventListener(‘onload’, personalizeWebsiteContext);

D.  

Document.addEventListener(‘‘’DOMContextLoaded’ , personalizeWebsiteContext);

Discussion 0