Free JavaScript-Developer-I Sample Questions and 100% Cover Real Exam Questions (Updated 215 Questions) [Q124-Q148]

Share

Free JavaScript-Developer-I Sample Questions and 100% Cover Real Exam Questions (Updated 215 Questions)

Download Real Salesforce JavaScript-Developer-I Exam Dumps Test Engine Exam Questions

NEW QUESTION 124
Given the code below:

What is the expected output?

  • A. Line 08 outputs the variable, but line 09 throws an error.
  • B. Both lines 06 and 09 are executed, but the values outputted are undefined.
  • 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: A

 

NEW QUESTION 125
Refer to the code below:

Which two statements correctly execute the runparallel () function?
Choose 2 answers

  • A. runParallel () , then (function ) (date) { } 0;
  • B. runParallel () , done (function ( data)(return data; }};
  • C. runParralel () . then (data );
  • D. Async runParalled (). Then (data) :

Answer: A,D

 

NEW QUESTION 126
A developer removes the HTML class attributes from the check button, so now it is simply:
<button>checkout<button>.
There is a test verify the existence of the checkout button, however it look for a button with class'' blue''. The test fails because no such button is f.
Which type of test category describes this test?

  • A. True positive
  • B. False negative
  • C. False positive
  • D. True negative

Answer: A

 

NEW QUESTION 127
A developer wants to create an object from a function in the browser using the code below.

What happens due to the lack of the mm keyword on line 02?

  • A. The m variable is assigned the correct object.
  • B. window.name is assigned to 'hello' and the variable = remains undefined.
  • C. window.m Is assigned the correct object.
  • D. The m variable is assigned the correct object but this.name remains undefined.

Answer: B

 

NEW QUESTION 128
A developer wants to leverage a module to print a price in pretty format, and has imported a method as shown below:
Import printPrice from '/path/PricePrettyPrint.js';
Based on the code, what must be true about the printPrice function of the PricePrettyPrint module for this import to work ?

  • A. printPrice must be a multi exportc
  • B. printPrice must be the default export
  • C. printPrice must be an all export
  • D. printPrice must be be a named export

Answer: B

 

NEW QUESTION 129
Refer to the following code:
function test (val) {
If (val === undefined) {
return 'Undefined values!' ;
}
if (val === null) {
return 'Null value! ';
}
return val;
}
Let x;
test(x);
What is returned by the function call on line 13?

  • A. 'Undefined values!'
  • B. Undefined
  • C. Line 13 throws an error.
  • D. 'Null value!'

Answer: B

 

NEW QUESTION 130
A developer at Universal Container creates a new landing page based on HTML, CSS, and JavaScript.
To ensure that visitors have a good experience, a script named personalizeewebsiteCotent needs to be executed when the webpage is fully loaded (HTML content and all related files), in order to do some custom initialization.
Which statement should be used to call personalizeWebsiteContent based on the above business requirement?

  • A. Document, addEventListener ('oDCMContentLoaded' , personalizewensiteContent);
  • B. Window, addEventListener('load', personalizewebsiteContent);
  • C. Window, addEventListener('onload', personalizewebsiteContent);
  • D. Document,addEventListener ('DCMContentLoaded' , personalizeWebsiteContent);

Answer: B

 

NEW QUESTION 131
A developer is required to write a function that calculates the sum of elements in an array but is getting undefined every time the code is executed. The developer needs to find what is missing in the code below.

Which option makes the code work as expected?

  • A. Replace line 03 with if 9 (arr. Length == 0) ( return 0; )
  • B. Replace line 04 with result + current ;
  • C. Replace line 05 with return results;
  • D. Replace line 02 with return arr. map ( (result, current => (

Answer: C

 

NEW QUESTION 132
A developer at Universal Containers creates a new landing page based on HTML, CSS, and JavaScript TO ensure that visitors have a good experience, a script named personaliseContext needs to be executed when the webpage is fully loaded (HTML content and all related files ), in order to do some custom initialization.
Which statement should be used to call personalizeWebsiteContent based on the above business requirement?

  • A. window.addEventListener('load',personalizeWebsiteContext);
  • B. Document.addEventListener('''DOMContextLoaded' , personalizeWebsiteContext);
  • C. document.addEventListener(''onDOMContextLoaded', personalizeWebsiteContext);
  • D. window.addEventListener('onload', personalizeWebsiteContext);

Answer: A

 

NEW QUESTION 133
Refer to the code below:
Async funct on functionUnderTest(isOK) {
If (isOK) return 'OK' ;
Throw new Error('not OK');
)
Which assertion accurately tests the above code?

  • A. Console.assert (await functionUnderTest(true), ' not OK ')
  • B. Console.assert (await functionUnderTest(true), 'OK')
  • C. Console.assert (await functionUnderTest(true), ' OK ')
  • D. Console.assert (await functionUnderTest(true), ' not OK ')

Answer: B

 

NEW QUESTION 134
A developer at Universal Containers is creating their new landing page based on HTML, CSS, and JavaScript. The website includes multiple external resources that are loaded when the page is opened.
To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed when the webpage Is loaded and there Is no need to wait for the resources to be available.
Which statement should be used to call personalizeWebsiteContent based on the above business requirement?

  • A. windows,addEventListener('onload', personalizeWebsiteContent);
  • B. windows,addEventListener('DOMContent Loaded ', personalizeWebsiteContent);
  • C. windows,addEventListener('onDOMCContentLoaded', personalizeWebsiteContent);
  • D. windows,addEventListener('load', personalizeWebsiteContent);

Answer: D

 

NEW QUESTION 135
Refer to the code below:
Const myFunction = arr => {
Return arr.reduce((result, current) =>{
Return result = current;
}, 10};
}
What is the output of this function when called with an empty array ?

  • A. Returns 10
  • B. Returns NaN
  • C. Returns 0
  • D. Throws an error

Answer: A

 

NEW QUESTION 136
Refer to the code:

Given the code above, which three properties are set for pet1? Choose 3 answers

  • A. type
  • B. name
  • C. canTalk
  • D. speak
  • E. owner

Answer: A,B,C

 

NEW QUESTION 137
Which JavaScript method can be used to serialize an object into a string and deserialize a JSON string into an object, respectively?

  • A. JSON,serialize and JSON,desrialize
  • B. JSON.parse and JSON deserialize
  • C. JSON.encode and JSON decode
  • D. JSON.Stringify and JSON.parse

Answer: A

 

NEW QUESTION 138
The developer wants to test this code:
Const toNumber =(strOrNum) => strOrNum;
Which two tests are most accurate for this code?
Choose 2 answers

  • A. console.assert(toNumber('2') === 2);
  • B. console.assert(toNumber('-3') < 0);
  • C. console.assert(Number.isNaN(toNumber()));
  • D. console.assert(toNumber () === NaN);

Answer: A,B

 

NEW QUESTION 139
Refer to the code below:

What is the value of result when the code executes?

  • A. 10 - 5
  • B. 10 - 10
  • C. 5 - 5
  • D. 5 - 10

Answer: B

 

NEW QUESTION 140
A developer wants to use a module named universalContainerLib and then call functions from it.
How should a developer import every function from the module and then call the functions foo and bar?

  • A. import + from '/path/universalContainerLib.js''
    universalContainersLib.foo( ) ;
    universalContainersLib bar ( ) :
  • B. import all from '/path/universalContainerLib.js''
    universalContainersLib.foo( ) ;
    universalContainersLib bar ( ) :
  • C. import (foo,bar) from '/path/universalContainerLib.js''
    foo ( ) ;
    bar ( ) ;
  • D. import - as lib from '/path/universalContainerLib.js''
    lib.foo( ) ;
    lib. bar ( ) ;

Answer: D

 

NEW QUESTION 141
Cloud Kicks has a class to represent item for sale in an online store, as shown below:

A new business requirement comes in that request a clothingitem class, that should have all of the properties and methods of the item class, but will also have properties that are specific top clothes.
Which line of code properly declares the clothingitem class such that it inherits from item?

  • A. Class clothingitem extends item (
  • B. Class Clothingitem (
  • C. Class clothing item super item (
  • D. Class clothingitem implements item (

Answer: A

 

NEW QUESTION 142
Refer to the following code:

Which two statement could be inserted at line 17 to enable the function call on line 18?
Choose 2 answers

  • A. leo.prototype.roar = ( ) =>( console.log('They\'re pretty good!'); };
  • B. Object.assign (leo, tony);
  • C. Object.assign (leo. Tiger);
  • D. leo.roar = () => { console.log('They\'re pretty good!'); );

Answer: B,D

 

NEW QUESTION 143
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 Hello, Hello.
  • B. Greeting is Goodbye and salutation is I say Hello.
  • C. Greeting is Hello and salutation is I say hello.
  • D. Greeting is Hello and salutation is Hello, Hello.

Answer: D

 

NEW QUESTION 144
Refer to the code below:
Const resolveAfterMilliseconds = (ms) => Promise.resolve (
setTimeout (( => console.log(ms), ms ));
Const aPromise = await resolveAfterMilliseconds(500);
Const bPromise = await resolveAfterMilliseconds(500);
Await aPromise, wait bPromise;
What is the result of running line 05?

  • A. aPromise and bPromise run in parallel.
  • B. Neither aPromise or bPromise runs.
  • C. aPromise and bPromise run sequentially.
  • D. Only aPromise runs.

Answer: B

 

NEW QUESTION 145
Which statement parses successfully?

  • A. JSON.parse ('' 'foo' '');
  • B. JSON.parse ('foo ');
  • C. JSON.parse (''foo '');
  • D. JSON.parse ('' 'foo'' ');

Answer: C

 

NEW QUESTION 146
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
  • B. When rejected
  • C. When resolved and settled
  • D. When resolved or rejected

Answer: D

 

NEW QUESTION 147
Refer to the code below:

What is the output of this function when called with an empty array?

  • A. Return 5
  • B. Return 0
  • C. Return NaN
  • D. Return Infinity

Answer: A

 

NEW QUESTION 148
......

New JavaScript-Developer-I exam dumps Use Updated Salesforce Exam: https://www.dumpstests.com/JavaScript-Developer-I-latest-test-dumps.html

Verified JavaScript-Developer-I Dumps Q&As - JavaScript-Developer-I Test Engine with Correct Answers: https://drive.google.com/open?id=1ClJuT69qNoL0XMwAGADN5bFkqP04H4in