ExamGecko
Ask Question

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

Add to Whishlist

List of questions

Question 61

Report Export Collapse

Universal Containers recently launched its new landing page to host a crowd-funding campaign. The page uses an external library to display some third-party ads. Once the page is fully loaded, it creates more than 50 new HTML items placed randomly inside the DOM, like the one in the code below:

Salesforce Certified JavaScript Developer I image Question 61 63732 09232024002545000000

All the elements includes the same ad-library-item class, They are hidden by default, and they are randomly displayed while the user navigates through the page.

Become a Premium Member for full access
  Unlock Premium Member

Question 62

Report Export Collapse

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

Become a Premium Member for full access
  Unlock Premium Member

Question 63

Report Export Collapse

is below:

<input type="file" onchange="previewFile()">

<img src="" height="200" alt="Image Preview…"/>

The JavaScript portion is:

01 function previewFile(){

02 const preview = document.querySelector('img');

03 const file = document.querySelector('input[type=file]').files[0];

04 //line 4 code

05 reader.addEventListener("load", () => {

06 preview.src = reader.result;

07 },false);

08 //line 8 code

09 }

In lines 04 and 08, which code allows the user to select an image from their local computer , and to display the image in the browser?

Become a Premium Member for full access
  Unlock Premium Member

Question 64

Report Export Collapse

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?

Become a Premium Member for full access
  Unlock Premium Member

Question 65

Report Export Collapse

A developer wrote the following code:

01 let X = object.value;

02

03 try {

04 handleObjectValue(X);

05 } catch (error) {

06 handleError(error);

07 }

The developer has a getNextValue function to execute after handleObjectValue(), but does not want to execute getNextValue() if an error occurs.

How can the developer change the code to ensure this behavior?

Become a Premium Member for full access
  Unlock Premium Member

Question 66

Report Export Collapse

Refer to the code:

Salesforce Certified JavaScript Developer I image Question 66 63737 09232024002545000000

Given the code above, which three properties are set pet1?

Choose 3 answers:

Become a Premium Member for full access
  Unlock Premium Member

Question 67

Report Export Collapse

Refer to the code below:

Let car1 = new Promise((_ , reject) =>

setTimeout(reject, 2000, "car 1 crashed in" =>

Let car2 =new Promise(resolve => setTimeout(resolve, 1500, "car 2 completed")

Let car3 =new Promise(resolve => setTimeout(resolve, 3000, "car 3 completed")

Promise.race(( car1, car2, car3))

.then (value => (

Let result = '$(value) the race.';)}

.catch(arr => {

console.log("Race is cancelled.", err);

});

What is the value of result when Promise.race executes?

Become a Premium Member for full access
  Unlock Premium Member

Question 68

Report Export Collapse

Refer to the following code:

Let sampleText = 'The quick brown fox jumps';

A developer needs to determine if a certain substring is part of a string.

Which three expressions return true for the given substring ?

Choose 3 answers

Become a Premium Member for full access
  Unlock Premium Member

Question 69

Report Export Collapse

Given two expressions var1 and var2. What are two valid ways to return the logical AND of the two expressions and ensure it is data type Boolean ?

Choose 2 answers:

Become a Premium Member for full access
  Unlock Premium Member

Question 70

Report Export Collapse

Cloud Kicks has a class to represent items for sale in an online store, as shown below:

Class Item{ constructor (name, price){ this.name = name; this.price = price;

} formattedPrice(){ return 's' + String(this.price);}} A new business requirement comes in that requests a ClothingItem class that should have all of the properties and methods of the Item class but will also have properties that are specific to clothes.

Which line of code properly declares the clothingItem class such that it inherits from Item?

Become a Premium Member for full access
  Unlock Premium Member
Total 224 questions
Go to page: of 23
Search

Related questions