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.

Use the DOM inspector to prevent the load event to be fired.
Use the DOM inspector to prevent the load event to be fired.
Use the browser to execute a script that removes all the element containing the class ad-libraryitem.
Use the browser to execute a script that removes all the element containing the class ad-libraryitem.
Use the DOM inspector to remove all the elements containing the class ad-library-item.
Use the DOM inspector to remove all the elements containing the class ad-library-item.
Use the browser console to execute a script that prevents the load event to be fired.
Use the browser console to execute a script that prevents the load event to be fired.
Suggested answer: C
asked 23/09/2024
Amine Alami
41 questions

Question 62

Report Export Collapse

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

const retrieveFromLocalStorage = () =>{return JSON.stringify(window.localStorage.getItem(storageKey));}
const retrieveFromLocalStorage = () =>{return JSON.stringify(window.localStorage.getItem(storageKey));}
const retrieveFromLocalStorage = (storageKey) =>{return window.localStorage.getItem(storageKey);}
const retrieveFromLocalStorage = (storageKey) =>{return window.localStorage.getItem(storageKey);}
const retrieveFromLocalStorage = (storageKey) =>{return JSON.parse(window.localStorage.getItem(storageKey));}
const retrieveFromLocalStorage = (storageKey) =>{return JSON.parse(window.localStorage.getItem(storageKey));}
const retrieveFromLocalStorage = (storageKey) =>{return window.localStorage[storageKey];}
const retrieveFromLocalStorage = (storageKey) =>{return window.localStorage[storageKey];}
Suggested answer: C
asked 23/09/2024
Garvey Butler
50 questions

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?

04 const reader = new File();08 if (file) URL.createObjectURL(file);
04 const reader = new File();08 if (file) URL.createObjectURL(file);
04 const reader = new FileReader();08 if (file) URL.createObjectURL(file);
04 const reader = new FileReader();08 if (file) URL.createObjectURL(file);
04 const reader = new File();08 if (file) reader.readAsDataURL(file);
04 const reader = new File();08 if (file) reader.readAsDataURL(file);
04 const reader = new FileReader();08 if (file) reader.readAsDataURL(file);
04 const reader = new FileReader();08 if (file) reader.readAsDataURL(file);
Suggested answer: D
asked 23/09/2024
Vahit Erciyas
46 questions

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?

Assert
Assert
Log
Log
Message
Message
Info
Info
Error
Error
Suggested answer: B, D, E
asked 23/09/2024
Dominique Reemer
43 questions

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?

03 try{04 handleObjectValue(x);05 } catch(error){06 handleError(error);07 } then {08 getNextValue();09 }
03 try{04 handleObjectValue(x);05 } catch(error){06 handleError(error);07 } then {08 getNextValue();09 }
03 try{04 handleObjectValue(x);05 } catch(error){06 handleError(error);07 } finally {08 getNextValue();10 }
03 try{04 handleObjectValue(x);05 } catch(error){06 handleError(error);07 } finally {08 getNextValue();10 }
03 try{04 handleObjectValue(x);05 } catch(error){06 handleError(error);07 }08 getNextValue();
03 try{04 handleObjectValue(x);05 } catch(error){06 handleError(error);07 }08 getNextValue();
03 try {04 handleObjectValue(x)05 ……………………
03 try {04 handleObjectValue(x)05 ……………………
Suggested answer: D
asked 23/09/2024
Mohammed Meddah
42 questions

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:

Name
Name
canTalk
canTalk
Type
Type
Owner
Owner
Size
Size
Suggested answer: B, C, E
asked 23/09/2024
Angela Stevens
67 questions

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?

Car 3 completes the race
Car 3 completes the race
Car 2 completed the race.
Car 2 completed the race.
Car 1 crashed in the race.
Car 1 crashed in the race.
Race is cancelled.
Race is cancelled.
Suggested answer: B
asked 23/09/2024
HNO Oo
42 questions

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

sampleText.includes('fox');
sampleText.includes('fox');
sampleText.includes(' quick ', 4);
sampleText.includes(' quick ', 4);
sampleText.includes(' Fox ', 3)
sampleText.includes(' Fox ', 3)
sampleText.includes(' fox ');
sampleText.includes(' fox ');
sampleText.includes(' quick ') !== -1;
sampleText.includes(' quick ') !== -1;
Suggested answer: B, D, E
asked 23/09/2024
Christopher Harden
56 questions

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:

Boolean(var1 && var2)
Boolean(var1 && var2)
var1 && var2
var1 && var2
var1.toBoolean() && var2toBoolean()
var1.toBoolean() && var2toBoolean()
Boolean(var1) && Boolean(var2)
Boolean(var1) && Boolean(var2)
Suggested answer: A, D
asked 23/09/2024
Kaniamuthan K
49 questions

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?

Class ClothingItem implements Item{
Class ClothingItem implements Item{
Class ClothingItem {
Class ClothingItem {
Class ClothingItem super Item {
Class ClothingItem super Item {
Class ClothingItem extends Item {
Class ClothingItem extends Item {
Suggested answer: D
asked 23/09/2024
benakli rabah
29 questions
Total 224 questions
Go to page: of 23
Search

Related questions