Summer Sale Limited Time 75% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code = simple75

Pass the Salesforce Developer JavaScript-Developer-I Questions and answers with Dumpstech

Exam JavaScript-Developer-I Premium Access

View all detail and faqs for the JavaScript-Developer-I exam

Practice at least 50% of the questions to maximize your chances of passing.
Viewing page 4 out of 5 pages
Viewing questions 31-40 out of questions
Questions # 31:

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 personalizeWebsiteContent needs to be executed to do some custom initialization when the webpage is fully loaded with HTML content and all related files.

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

Options:

A.

document.addEventListener( ' DOMContentLoaded ' , personalizeWebsiteContent);

B.

document.addEventListener( ' onDOMContentLoaded ' , personalizeWebsiteContent);

C.

window.addEventListener( ' load ' , personalizeWebsiteContent);

D.

window.addEventListener( ' onload ' , personalizeWebsiteContent);

Questions # 32:

Given the following code:

01 counter = 0;

02 const logCounter = () = > {

03 console.log(counter);

04 };

05 logCounter();

06 setTimeout(logCounter, 2100);

07 setInterval(() = > {

08 counter++;

09 logCounter();

10 }, 1000);

What will be the first four numbers logged?

Options:

A.

0122

B.

0123

C.

0112

D.

0012

Questions # 33:

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?

Options:

A.

console.timeLog()

B.

console.trace()

C.

console.timeStamp()

D.

console.getTime()

Questions # 34:

Refer to the code below:

< html >

< body >

< div id= " logo " > Hello Logo! < /div >

< button id= " test " > Click me < /button >

< /body >

< script >

function printMessage(event) {

console.log( ' This is a test message ' );

}

let el = document.getElementById( ' test ' );

el.addEventListener( " click " , printMessage, false);

< /script >

< /html >

Which action should be done?

Options:

A.

Add event.removeEventListener(); to window.onload event handler

B.

Add event.removeEventListener(); to printMessage function

C.

Add event.stopPropagation(); to printMessage function

D.

Add event.stopPropagation(); to window.onload event handler

Questions # 35:

A developer has a module that contains multiple functions.

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

Options:

A.

multi

B.

default

C.

all

D.

named

Questions # 36:

Refer to the code below:

01 const objBook = {

02 title: ' JavaScript ' ,

03 };

04 Object.preventExtensions(objBook);

05 const newObjBook = objBook;

06 newObjBook.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 " }

{ author: " Robert " , title: " JavaScript " }

D.

{ author: " Robert " , title: " JavaScript " }

{ author: " Robert " , title: " JavaScript " }

Questions # 37:

Refer to the code below:

let strNumber = ' 12345 ' ;

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

Options:

A.

let numberValue = Integer(strNumber);

B.

let numberValue = textValue.toInteger();

C.

let numberValue = Number(strNumber);

D.

let numberValue = (number) textValue;

Questions # 38:

Refer to the code declarations below:

let str1 = ' Java ' ;

let str2 = ' Script ' ;

Which three expressions return the string JavaScript?

Options:

A.

`${str1}${str2}`

B.

str1.concat(str2);

C.

const({str1, str2});

D.

str1 + str2;

E.

str1.join(str2);

Questions # 39:

Refer to the following code:

01 let obj = {

02 foo: 1,

03 bar: 2

04 }

05 let output = []

06

07 for (let something of obj) {

08 output.push(something);

09 }

10

11 console.log(output);

What is the value of output on line 11?

Options:

A.

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

B.

[1, 2]

C.

[ " foo " , " bar " ]

D.

[ " foo:1 " , " bar:2 " ]

Questions # 40:

A developer needs the function personalizeWebsiteContent to run when the webpage is fully loaded (HTML and all external resources).

Which implementation should be used?

Options:

A.

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

B.

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

C.

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

D.

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

Viewing page 4 out of 5 pages
Viewing questions 31-40 out of questions