Winter Special Sale Limited Time 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 713PS592

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

Questions 4

Refer to code below:

Let productSKU = ‘8675309’ ;

A developer has a requirement to generate SKU numbers that are always 19 characters lon,

starting with ‘sku’, and padded with zeros.

Which statement assigns the values sku0000000008675309 ?

Options:

A.

productSKU = productSKU .padStart (19. ‘0’).padstart(‘sku’);

B.

productSKU = productSKU .padEnd (16. ‘0’).padstart(‘sku’);

C.

productSKU = productSKU .padEnd (16. ‘0’).padstart(19, ‘sku’);

D.

productSKU = productSKU .padStart (16. ‘0’).padstart(19, ‘sku’);

Buy Now
Questions 5

Given the following code:

Let x =null;

console.log(typeof x);

What is the output of the line 02?

Options:

A.

“Null”

B.

“X”

C.

“Object”

D.

“undefined”

Buy Now
Questions 6

Refer to the HTML below:

  • Leo
  • Tony
  • Tiger

Which JavaScript statement results in changing “ Tony” to “Mr. T.”?

Options:

A.

document.querySelectorAll(‘$main $TONY’).innerHTML = ’ Mr. T. ’;

B.

document.querySelector(‘$main li:second-child’).innerHTML = ’ Mr. T. ’;

C.

document.querySelector(‘$main li.Tony’).innerHTML = ’ Mr. T. ’;

D.

document.querySelector(‘$main li:nth-child(2)’),innerHTML = ’ Mr. T. ’;

Buy Now
Questions 7

Given the following code, what is the value of x?

let x = ‘15' + (10 * 2);

Options:

A.

35

B.

50

C.

1520

D.

3020

Buy Now
Questions 8

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.

Buy Now
Questions 9

A developer wants to use a module called DataPrettyPrint. This module exports one default function called printDate ().

How can a developer import and use the printDate() function?

A)

JavaScript-Developer-I Question 9

B)

JavaScript-Developer-I Question 9

C)

JavaScript-Developer-I Question 9

D)

JavaScript-Developer-I Question 9

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 10

JavaScript-Developer-I Question 10

Which code change should be done for the console to log the following when 'Click me!' is clicked'

> Row log

> Table log

Options:

A.

Remove lines 13 and 14

B.

Change line 10 to event.stopPropagation (false) ;

C.

Change line 14 to elem.addEventListener ('click', printMessage, true);

D.

Remove line 10

Buy Now
Questions 11

Refer the code below.

x=3.14;

function myfunction() {

"use strict";

y=x;

}

z=x;

myFunction();

Options:

Buy Now
Questions 12

A developer writes the code below to calculate the factorial of a given number

function sum(number){

return number * sum(number-1);

}

sum(3);

what is the result of executing the code.

Options:

A.

0

B.

6

C.

Error

D.

-Infinity

Buy Now
Questions 13

Refer to the following array:

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

Which three options result in x evaluating as [1, 2]?

Choose 3 answer

Options:

A.

let x = arr. slice (2);

B.

let x = arr. slice (0, 2);

C.

let x arr.filter((a) => (return a <= 2 });

D.

let x = arr.filter ((a) => 2 }) ;

E.

let x =arr.splice(0, 2);

Buy Now
Questions 14

A developer copied a JavaScript object:

JavaScript-Developer-I Question 14

How does the developer access dan's forstName,lastName? Choose 2 answers

Options:

A.

dan,name

B.

dan,firstname ( ) + dan, lastName ( )

C.

dan, firstName = dan.lastName

D.

dan,name ( )

Buy Now
Questions 15

Given the HTML below:

JavaScript-Developer-I Question 15

Which statement adds the priority-account CSS class to the Universal Containers row?

Options:

A.

document. querySelector (#row-uc'). classes-push('priority-account');

B.

document. getElementByid('row-uc').addClass('priority-account*);

C.

document. querySelectorAll('#row-uc') -classList.add("priority-accour');

D.

document. queryselector('#row-uc').ClassList.add('priority-account');

Buy Now
Questions 16

Given the code below:

Which three code segments result in a correct conversion from number to string? Choose 3 answers

Options:

A.

let strValue = numValue. toString();

B.

let strValue = * * 4 numValue;

C.

let strValue = numValue.toText ();

D.

let scrValue = String(numValue);

E.

let strValue = (String)numValue;

Buy Now
Questions 17

Given the following code:

JavaScript-Developer-I Question 17

is the output of line 02?

Options:

A.

''x''

B.

''null'''

C.

''object''

D.

''undefined''

Buy Now
Questions 18

Given the JavaScript below:

01 function filterDOM (searchString) {

02 const parsedSearchString = searchString && searchString.toLowerCase() ;

03 document.quesrySelectorAll(‘ .account’ ) . forEach(account => (

04 const accountName = account.innerHTML.toLOwerCase();

05 account. Style.display = accountName.includes(parsedSearchString) ? /*Insert

code*/;

06 )};

07 }

Which code should replace the placeholder comment on line 05 to hide accounts that do

not match the search string?

Options:

A.

‘ name ’ : ‘ block ’

B.

‘ Block ’ : ‘ none ’

C.

‘ visible ’ : ‘ hidden ’

D.

‘ hidden ’ : ‘ visible ’

Buy Now
Questions 19

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

JavaScript-Developer-I Question 19

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 20

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

Buy Now
Questions 21

A developer writes the code below to return a message to a user attempting to register a new username. If the username is available, a variable named nag is declared and assigned a value on line 03.

JavaScript-Developer-I Question 21

What is the value of msg when getAvailableabilityMessage (“newUserName”) is executed and get Availability (“newUserName”) returns true?

Options:

A.

"msg is not defined"

B.

"newUserName"

C.

"User-name available"

D.

undefined

Buy Now
Questions 22

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

}

22

Buy Now
Questions 23

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.

Buy Now
Questions 24

Refer to code below:

Function muFunction(reassign){

Let x = 1;

var y = 1;

if( reassign ) {

Let x= 2;

Var y = 2;

console.log(x);

console.log(y);}

console.log(x);

console.log(y);}

What is displayed when myFunction(true) is called?

Options:

A.

2 2 1 1

B.

2 2 undefined undefined

C.

2 2 1 2

D.

2 2 2 2

Buy Now
Questions 25

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 26

A developer wants to define a function log to be used a few times on a single-file JavaScript script.

01 // Line 1 replacement

02 console.log('"LOG:', logInput);

03 }

Which two options can correctly replace line 01 and declare the function for use?

Choose 2 answers

Options:

A.

function leg(logInput) {

B.

const log(loginInput) {

C.

const log = (logInput) => {

D.

function log = (logInput) {

Buy Now
Questions 27

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

Buy Now
Questions 28

A developer wants to use a try...catch statement to catch any error that countSheep () may throw and pass it to a handleError () function.

What is the correct implementation of the try...catch?

A)

JavaScript-Developer-I Question 28

B)

JavaScript-Developer-I Question 28

C)

JavaScript-Developer-I Question 28

D)

JavaScript-Developer-I Question 28

Options:

A.

Option

B.

Option

C.

Option

D.

Option

Buy Now
Questions 29

developer removes the HTML class attribute from the checkout button, so now it is

simply:

.

There is a test to verify the existence of the checkout button, however it looks for a button with

class= “blue”. The test fails because no such button is found.

Which type of test category describes this test?

Options:

A.

True positive

B.

True negative

C.

False positive

D.

False negative

Buy Now
Questions 30

Which three statements are true about promises ?

Choose 3 answers

Options:

A.

The executor of a new Promise runs automatically.

B.

A Promise has a .then() method.

C.

A fulfilled or rejected promise will not change states .

D.

A settled promise can become resolved.

E.

A pending promise can become fulfilled, settled, or rejected.

Buy Now
Questions 31

A developer initiates a server with the file server,js and adds dependencies in the source codes package,json that are required to run the server.

Which command should the developer run to start the server locally?

Options:

A.

start server,js

B.

npm start server,js

C.

npm start

D.

node start

Buy Now
Questions 32

Refer to the code below:

function foo () {

const a =2;

function bat() {

console.log(a);

}

return bar;

}

Why does the function bar have access to variable a ?

Options:

A.

Inner function’s scope

B.

Hoisting

C.

Outer function’s scope

D.

Prototype chain

Buy Now
Questions 33

Refer to the code below:

JavaScript-Developer-I Question 33

What is the output of this function when called with an empty array?

Options:

A.

Return 0

B.

Return 5

C.

Return NaN

D.

Return Infinity

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

PDF + Testing Engine

$66  $164.99

Testing Engine

$50  $124.99
buy now JavaScript-Developer-I testing engine

PDF (Q&A)

$42  $104.99
buy now JavaScript-Developer-I pdf