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

List of questions
Question 211

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?
Question 212

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
Question 213

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?
Question 214

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.
Question 215

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?
Question 216

Refer to the code below:
What is the result when the Promise in the execute function is rejected?
Question 217

Given the JavaScript below:
Which code should replace the placeholder comment on line 06 to hide accounts that do not match the search string?
Question 218

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?
Question 219

Given the following code:
What is the output of line 02?
Question 220

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?
Question