ExamGecko
Home Home / Salesforce / Certified JavaScript Developer I

Salesforce Certified JavaScript Developer I Practice Test - Questions Answers, Page 22

Question list
Search
Search

List of questions

Search

Related questions











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?

A.
Hello John Doe
A.
Hello John Doe
Answers
B.
Hello Dan
B.
Hello Dan
Answers
C.
Hello Dan Doe
C.
Hello Dan Doe
Answers
D.
SyntaxError: Unexpected token in JSON
D.
SyntaxError: Unexpected token in JSON
Answers
Suggested answer: D

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

A.
[ ].concat(...inArray);
A.
[ ].concat(...inArray);
Answers
B.
[ ].concat.apply(inArray,[ ]);
B.
[ ].concat.apply(inArray,[ ]);
Answers
C.
[ ].concat([...inArray])
C.
[ ].concat([...inArray])
Answers
D.
[ ].concat.apply([ ],inArray);
D.
[ ].concat.apply([ ],inArray);
Answers
Suggested answer: A, D

A developer has two ways to write a function:

Option A:

function Monster(){

this.growl = ()=>{

console.log('Grr!');

}}

Option B:

function Monster(){};

Monster.prototype.growl = ()=>{

console.log('Grr!');

}

After deciding on an option, the developer creates 1000 monster objects.

How many growl methods are created with Option A and Option B?

A.
1000 for Option A, 1 for Option B
A.
1000 for Option A, 1 for Option B
Answers
B.
1 methods for both
B.
1 methods for both
Answers
C.
1000 for both
C.
1000 for both
Answers
D.
1 for Option A, 1000 for Option B
D.
1 for Option A, 1000 for Option B
Answers
Suggested answer: B

Refer to the following code:

class Vehicle{

constructor(plate){

this.plate = plate;

}}

class Truck extends Vehicle{

constructor(plate, weight){

//Missing code

this.weight = weight;

}

displayWeight(){

console.log(`The truck ${this.plate} has a weight of ${this.weight}lb.`);

}}

let myTruck = new Truck('123Ab',5000);

myTruck.displayWeight();

Which statement should be added to missing code for the code to display 'The truck 123AB has a weight of 5000lb.

A.
super(plate)
A.
super(plate)
Answers
B.
super.plate = plate
B.
super.plate = plate
Answers
C.
Vehicle.plate = plate
C.
Vehicle.plate = plate
Answers
D.
this.plate = plate
D.
this.plate = plate
Answers
Suggested answer: A

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?

A.
100
A.
100
Answers
B.
undefined
B.
undefined
Answers
C.
null
C.
null
Answers
D.
70
D.
70
Answers
Suggested answer: A

Refer to the code below:

What is the result when the Promise in the execute function is rejected?

A.
Resolved1 Resolved2 Resolved3 Resolved4
A.
Resolved1 Resolved2 Resolved3 Resolved4
Answers
B.
Rejected
B.
Rejected
Answers
C.
Rejected Resolved
C.
Rejected Resolved
Answers
D.
Rejected1 Rejected2 Rejected3 Rejected Rejected Rejected4
D.
Rejected1 Rejected2 Rejected3 Rejected Rejected Rejected4
Answers
Suggested answer: C

Given the JavaScript below:

Which code should replace the placeholder comment on line 06 to hide accounts that do not match the search string?

A.
'None' : 'block'
A.
'None' : 'block'
Answers
B.
'Visible : 'hidden'
B.
'Visible : 'hidden'
Answers
C.
'Hidden, visible
C.
'Hidden, visible
Answers
D.
'Block' : 'none'
D.
'Block' : 'none'
Answers
Suggested answer: D

A developer tries to retrieve all cookies, then sets a certain key value pair in the cookie. These statements are used:

What is the behavior?

A.
Cookies are read, but the key value is not set because the value is not URL encoded.
A.
Cookies are read, but the key value is not set because the value is not URL encoded.
Answers
B.
Cookies are not read because line 01 should be document, cookies, but the key value is set and all cookies are wiped.
B.
Cookies are not read because line 01 should be document, cookies, but the key value is set and all cookies are wiped.
Answers
C.
A Cookies are read and the key value is set, the remaining cookies are unaffected.
C.
A Cookies are read and the key value is set, the remaining cookies are unaffected.
Answers
D.
Cookies are read and the key value is set, and all cookies are wiped.
D.
Cookies are read and the key value is set, and all cookies are wiped.
Answers
Suggested answer: C

Given the following code:

What is the output of line 02?

A.
"null"
A.
"null"
Answers
B.
"xC.
B.
"xC.
Answers
C.
"undefined" 0
C.
"undefined" 0
Answers
D.
'object"
D.
'object"
Answers
Suggested answer: D

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?

A.
Add a listener to the window object to handle the DOMContentLoaded event
A.
Add a listener to the window object to handle the DOMContentLoaded event
Answers
B.
Add a handler to the personalizeWebsiteContent script to handle the load event
B.
Add a handler to the personalizeWebsiteContent script to handle the load event
Answers
C.
Add a listener to the window object to handle the lead event
C.
Add a listener to the window object to handle the lead event
Answers
D.
Add a handler to the personalizeWebsiteContent script to handle the DOMContentLoaded event
D.
Add a handler to the personalizeWebsiteContent script to handle the DOMContentLoaded event
Answers
Suggested answer: C
Total 224 questions
Go to page: of 23