Salesforce JavaScript-Developer-I Practice Verified Answers - Pass Your Exams For Sure! [2021]
Valid Way To Pass Salesforce Developer's JavaScript-Developer-I Exam
NEW QUESTION 49
A developer uses a parsed JSON string to work with user information as in the block below:
Which two option access the email attributes in the object? Choose 2 answers
- A. userInformation ( ''email'' )
- B. userInformation(email)
- C. userInformation. email
- D. userInformation. Get (''email'')
Answer: A,C
NEW QUESTION 50
A developer creates a class that represents a blog post based on the requirements that a Post should have a body, author, and view count. The code is shown below:
Which statement should be inserted in the placeholder on line 02 to allow for a variable to be sent to a new instance of a port with the three attributes correctly populated?
- A. Constructor (body, author, viewCount) (
- B. Function Post (body, author, viewCount) (
- C. Constructor ( ) (
- D. Super (body, author, viewCount) (
Answer: A
NEW QUESTION 51
A developer is wondering whether to use, promise, then or provise, catch especially when a promise throws an error.
Which two promises are rejected? Choose 2 answers
- A. Promise , reject ('Cool error here ') , catch (error => console ,error (error));
- B. Promise, rejected (Cool error here'), then (error => console (error ));
- C. New promise (() => (throw 'Cool error here ')) , then ((null, error => console, (error)));
- D. New Promise((resolve, reject) => ( throw 'Cool error here')) .catch (error => console (error ));
Answer: C,D
NEW QUESTION 52
Refer to the code below:
Let textvalue = '1984';
Which code segment shows a correct way to convert this string to an integer?
- A. Let numberValue = textValue. Tointeger ( ) ;
- B. Let numberValue = Integer ( textValue );
- C. Let numberValue = (Number) textvalue;
- D. Let numberValue = Number(textvalue);
Answer: D
NEW QUESTION 53
Refer to the code:
Given the code above, which three properties are set pet1?
Choose 3 answers:
- A. Name
- B. Size
- C. Type
- D. canTalk
- E. Owner
Answer: B,C,D
NEW QUESTION 54
Refer to the code below:
Line 05 causes an error.
What are the values of greeting and salutation once code completes?
- A. Greeting is Goodbye and salutation is I say Hello.
- B. Greeting is Goodbye and salutation is Hello, Hello.
- C. Greeting is Hello and salutation is Hello, Hello.
- D. Greeting is Hello and salutation is I say hello.
Answer: C
NEW QUESTION 55
Given the code below:
What happens when the code executes?
- A. The ur1 variable has global scope and line 02 executes correctly.
- B. The ur1 variable has global scope and line 02 throws an error.
- C. The ur1 variables has local scope and line 02 throws an error.
- D. The ur1 variable has local scope and line 02 executes correctly.
Answer: A
NEW QUESTION 56
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:
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.
- A. Use the DOM inspector to prevent the load event to be fired.
- B. Use the browser console to execute a script that prevents the load event to be fired.
- C. Use the browser to execute a script that removes all the element containing the class ad-library-item.
- D. Use the DOM inspector to remove all the elements containing the class ad-library-item.
Answer: C
NEW QUESTION 57
Teams at Universal Containers (CU) work on multiple JavaScript projects at the same time. UC us thinking about reusability and how each team can benefit from the work of others.
Going open-source or public is not an option at this time.
Which option is available to UC with npm?
- A. Private registries are not supported by spm, but packages can be installed vis URL.
- B. Private register are not supported by npm, but packages can be installed via git.
- C. Private packages are not supported, but they can use another package manager like yarm.
- D. Private packages can be scoped, and scopes can be associated to a private registries.
Answer: C
NEW QUESTION 58
developer creates a new web server that uses Node.js. It imports a server library that uses events and callbacks for handling server functionality.
The server library is imported with require and is made available to the code by a variable named server. The developer wants to log any issues that the server has while booting up.
Given the code and the information the developer has, which code logs an error at boost with an event?
- A. Server.error ((server) => {
console.log('ERROR', error);
}); - B. Server.catch ((server) => {
console.log('ERROR', error);
}); - C. Try{
server.start();
} catch(error) { - D. Server.on ('error', (error) => {
console.log('ERROR', error);
});
Answer: D
Explanation:
console.log('ERROR', error);
}
NEW QUESTION 59
Given the following code:
What is the output of line 02?
- A. ''object''
- B. ''null''
- C. ''x''
- D. ''Undefined''
Answer: A
NEW QUESTION 60
Given the following code:
Let x = ('15' +10) +2;
What is the value of x?
- A. 0
- B. 1
- C. 2
- D. 3
Answer: D
NEW QUESTION 61
A developer wants to literate through an array of objects and count the objects whose property value, name, start with the letter N. const arrobj - [{''name ''t ''Zach''}, { ''name t Kate'') , ( ''name Alice'') < ( ''name'' t ''Bob'') , (''name'' t ''Nathan) , (''name'' t ''Nathandle1'')] Refer to the code snippet below:
Which missing lines 02 and 03 return the correct count?
- A. Conset sun + curr. StartsWith ('N') 7 1 : 1;
Return acc + sum ; - B. Const sum = curr. name startsWith ('N') 7 1 : 0;
Return curr + sum; - C. Comst sum = curr. name startsWith ('N') 7 1 : 0;
Return curr + sum; - D. Comst sum = curr. Name startsWith ('N') 7 1 : 0
Return acc + sum;
Answer: D
NEW QUESTION 62
A developer wants to create a simple image upload in the browser using the File API. The HTML is below:
The JavaScript portion is:
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?
- A. 04 const reader = new File ( ) ;
08 if (file) ,reader, readerAsDataURL (file) ; - B. 04 const reader = new FileReader ( ) ;
08 if (file) URL , createObjectURL (file) ; - C. 04 const reader = new File ( ) ;
08 if (file) URL , createObjectURL (file) ; - D. 04 const reader = new FileReader ( ) ;
08 if (file) reader , createAsDataURL (file) ;
Answer: C
NEW QUESTION 63
Given the code below:
What is the expected output?
- A. Both lines 06 and 09 are executed, but the values outputted are undefined.
- B. Line 08 outputs the variable, but line 09 throws an error.
- C. Both lines 08 and 09 are executed, and the variables are outputted.
- D. Line 08 throws an error, therefore line 09 is never executed.
Answer: B
NEW QUESTION 64
A developer is creating a simple webpage with a button. When a user clicks this button for the first time, a message is displayed.
The developer wrote the JavaScript code below, but something is missing. The message gets displayed time a user clicks the button instead of just the first time.
Which two code lines make this code work as required? Choose 2 answers
- A. On line 04, use event .stopPropagetion ( );
- B. On line 06, ad an option called once to button. addEventlistener ( ).
- C. On line 02, use event.first to test if it is the first execution.
- D. On line 04, use button. removeEventlistener ('click', listen );
Answer: B,D
NEW QUESTION 65
Which statement can a developer apply to increment the browser's navigation history without a page refesh?
- A. Window.history,pushState.(newStateObject, ' ', null)) ;
- B. Window.history,pushState.(newStateObject);
- C. Window.history,state,push.(newStateObject);
- D. Window.history,state,push.(newStateObject, ' ' null;
Answer: D
NEW QUESTION 66
Refer to the code below:
new Promise((resolve, reject) => {
const fraction = Math.random();
if( fraction >0.5) reject("fraction > 0.5, " + fraction);
resolve(fraction);
})
.then(() =>console.log("resolved"))
.catch((error) => console.error(error))
.finally(() => console.log(" when am I called?"));
When does Promise.finally on line 08 get called?
- A. When resolved or rejected
- B. When rejected
- C. WHen resolved
- D. When resolved and settled
Answer: A
NEW QUESTION 67
......
Salesforce JavaScript-Developer-I Pre-Exam Practice Tests | PracticeVCE: https://www.practicevce.com/Salesforce/JavaScript-Developer-I-practice-exam-dumps.html
JavaScript-Developer-I practice test questions, answers, explanations: https://drive.google.com/open?id=1CmVN6wx5Cnlu2lOYyrSOcpenxwKmNcVv