Pre-Winter Sale Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: v4s65

JavaScript-Developer-I Exam Dumps - Salesforce Certified JavaScript Developer I (SU24)

Question # 4

Given the HTML below:

Which statement adds the priority-account css class to the Applied Shipping row?

A.

document.querySelector('#row-as').classList.add('priority-account');

Full Access
Question # 5

Refer to the code below:

let o = {

get js() {

let city1 = String("st. Louis");

let city2 = String(" New York");

return {

firstCity: city1.toLowerCase(),

secondCity: city2.toLowerCase(),

}

}

}

What value can a developer expect when referencing o.js.secondCity?

A.

Undefined

B.

‘ new york ’

C.

‘ New York ’

D.

An error

Full Access
Question # 6

Given the following code:

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

What is the value of a?

A.

3020

B.

1520

C.

50

D.

35

Full Access
Question # 7

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

Choose 3 answers

A.

IIFEs

B.

indexedDB

C.

Global variables

D.

Cookies

E.

localStorage.

Full Access
Question # 8

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?

A.

Event.clicked

B.

e.nodeTarget ==this

C.

event.target.nodeName == ‘BUTTON’

D.

button.addEventListener(‘click’)

Full Access
Question # 9

A developer creates a generic function to log custom messages in the console. To do this,

the function below is implemented.

01 function logStatus(status){

02 console./*Answer goes here*/{‘Item status is: %s’, status};

03 }

Which three console logging methods allow the use of string substitution in line 02?

A.

Assert

B.

Log

C.

Message

D.

Info

E.

Error

Full Access
Question # 10

Which two options are core Node.js modules?

Choose 2 answers

A.

worker

B.

isotream

C.

exception

D.

http

Full Access
Question # 11

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

Choose 2 answers

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.

Full Access
Question # 12

A developer implements a function that adds a few values.

Function sum(num) {

If (num == undefined) {

Num =0;

}

Return function( num2, num3){

If (num3 === undefined) {

Num3 =0 ;

}

Return num + num2 + num3;

}

}

Which three options can the developer invoke for this function to get a return value of 10 ?

Choose 3 answers

A.

Sum () (20)

B.

Sum (5, 5) ()

C.

sum() (5, 5)

D.

sum(5)(5)

E.

sum(10) ()

Full Access
Question # 13

A developer has an ErrorHandler module that contains multiple functions.

What kind of export be leverages so that multiple functions can be used?

A.

Named

B.

All

C.

Multi

D.

Default

Full Access
Question # 14

Refer to the following code:

What is the value of output on line 11?

A.

[1, 2]

B.

[‘’foo’’, ‘’bar’’]

C.

[‘’foo’’:1, ‘’bar’’:2’’]

D.

An error will occur due to the incorrect usage of the for…of statement on line 07.

Full Access
Question # 15

Which three statements are true about promises ?

Choose 3 answers

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.

Full Access
Question # 16

Which three actions can be using the JavaScript browser console?

Choose 3 answers:

A.

View and change DOM the page.

B.

Display a report showing the performance of a page.

C.

Run code that is not related to page.

D.

view , change, and debug the JavaScript code of the page.

E.

View and change security cookies.

Full Access
Question # 17

Which statement phrases successfully?

A.

JSON.parse ( ‘ foo ’ );

B.

JSON.parse ( “ foo ” );

C.

JSON.parse( “ ‘ foo ’ ” );

D.

JSON.parse(‘ “ foo ” ’);

Full Access
Question # 18

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?

A.

event.target.id =='myElement'

Full Access
Question # 19

Refer to the code below:

What is the value of result after line 10 executes?

A.

Error: myFather.job is not a function

B.

John Developer

C.

undefined Developer

D.

John undefined

Full Access
Question # 20

Given the following code:

is the output of line 02?

A.

''x''

B.

''null'''

C.

''object''

D.

''undefined''

Full Access
Question # 21

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?

A.

console. timeLog ()

B.

console.timeStamp ()

C.

console.trace()

D.

console.getTime ()

Full Access
Question # 22

Consider type coercion, what does the following expression evaluate to?

True + 3 + ‘100’ + null

A.

104

B.

4100

C.

‘3100null’

D.

‘4100null’

Full Access
Question # 23

Refer to the code below:

let sayHello = () => {

console.log (‘Hello, world!’);

};

Which code executes sayHello once, two minutes from now?

A.

setTimeout(sayHello, 12000);

B.

setInterval(sayHello, 12000);

C.

setTimeout(sayHello(), 12000);

D.

delay(sayHello, 12000);

Full Access
Question # 24

Refer to the code below:

const addBy = ?

const addByEight =addBy(8);

const sum = addBYEight(50);

Which two functions can replace line 01 and return 58 to sum?

Choose 2 answers

A.

const addBy = function(num1){

return function(num2){

return num1 + num2;

}

B.

const addBy = function(num1){

return num1 + num2;

}

C.

const addBy = (num1) => num1 + num2 ;

D.

const addBY = (num1) => (num2) => num1 + num2;

Full Access
Question # 25

Refer to the code below:

Function changeValue(obj) {

Obj.value = obj.value/2;

}

Const objA = (value: 10);

Const objB = objA;

changeValue(objB);

Const result = objA.value;

What is the value of result after the code executes?

A.

10

B.

Nan

C.

5

D.

Undefined

Full Access
Question # 26

Refer to following code block:

Let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,];

Let output =0;

For (let num of array){

if (output >0){

Break;

}

if(num % 2 == 0){

Continue;

}

Output +=num;

What is the value of output after the code executes?

A.

16

B.

36

C.

11

D.

25

Full Access
Question # 27

A developer creates a simple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must be displayed in the console.

Here is the HTML file content:

The developer wrote the javascript code below:

Const button = document.querySelector(‘button’);

button.addEvenListener(‘click’, () => (

Const input = document.querySelector(‘input’);

console.log(input.getAttribute(‘value’));

When the user clicks the button, the output is always “Hello”.

What needs to be done to make this code work as expected?

A.

Replace line 04 with console.log(input .value);

B.

Replace line 03 with const input = document.getElementByName(‘input’);

C.

Replace line 02 with button.addCallback(“click”, function() {

D.

Replace line 02 with button.addEventListener(“onclick”, function() {

Full Access
Question # 28

Refer the following code

what is the value of array after code executes?

Full Access
Question # 29

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

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

A.

On the browser JavaScript console

B.

On the terminal console running the web server

C.

In the browser performance tools log

D.

On the webpage console log

Full Access
Question # 30

Which code statement correctly retrieves and returns an object from localStorage?

A.

const retrieveFromLocalStorage = () =>{

return JSON.stringify(window.localStorage.getItem(storageKey));

}

B.

const retrieveFromLocalStorage = (storageKey) =>{

return window.localStorage.getItem(storageKey);

}

C.

const retrieveFromLocalStorage = (storageKey) =>{

return JSON.parse(window.localStorage.getItem(storageKey));

}

D.

const retrieveFromLocalStorage = (storageKey) =>{

return window.localStorage[storageKey];

}

Full Access
Question # 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 ?

A.

Object.const()

B.

Object.eval()

C.

Object.lock()

D.

Object.freeze()

Full Access
Question # 32

Refer to the code below?

Let searchString = ‘ look for this ’;

Which two options remove the whitespace from the beginning of searchString?

Choose 2 answers

A.

searchString.trimEnd();

B.

searchString.trimStart();

C.

trimStart(searchString);

D.

searchString.replace(/*\s\s*/, ‘’);

Full Access
Question # 33

Refer to the code below:

Let textValue = ’1984’;

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

A.

let numberValue = Number(textValue);

B.

Let numberValue = (Number)textValue;

C.

Let numberValue = textValue.toInteger();

D.

Let numberValue = Integer(textValue);

Full Access