You are on page 1of 19

Recommend!!

Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

Salesforce
Exam Questions JavaScript-Developer-I
Salesforce Certified JavaScript Developer I

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

NEW QUESTION 1
Refer to the code below:
<html lang=”en”>
<table onclick=”console.log(Table log’);”>
<tr id=”row1”>
<td>Click me!</td>
</tr>
<table>
<script>
function printMessage(event) { console.log(‘Row log’);
}
Let elem = document.getElementById(‘row1’); elem.addEventListener(‘click’, printMessage, false);
</script>
</html>
Which code change should be made for the console to log only Rowlog when ‘Click me! ’ is clicked?

A. Add.event.stopPropagation(); to window.onLoad event handler.


B. Add event.stopPropagation(); to printMessage function.
C. Add event.removeEventListener(); to window.onLoad event handler.
D. Addevent.removeEventListener(); toprintMessage function.

Answer: B

NEW QUESTION 2
Refer to the code snippet:

A developer writes this code to return a message to userattempting to register a new username. If the username is available, variable.
What is the return value of msg hen getAvailabilityMessage (“newUserName” ) is executed and getAvailability(“newUserName”) returns false?

A. “Username available”
B. “newUserName”
C. “Msg is not defined”
D. undefined

Answer: D

NEW QUESTION 3
A developer receives a comment from the Tech Lead that the code given below has error:
const monthName = ‘July’; const year = 2019;
if(year === 2019) { monthName = ‘June’;
}
Which line edit should be made to make this code run?

A. 01 let monthName =’July’;


B. 02 let year =2019;
C. 02 const year = 2020;
D. 03 if (year == 2019) {

Answer: A

NEW QUESTION 4
Refer to the code below:

What value can a developer expect when referencing o.js.secondCity?

A. Undefined

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

B. ‘ new york ’
C. ‘ New York ’
D. An error

Answer: B

NEW QUESTION 5
Refer to the code below: Let str = ‘javascript’; Str[0] = ‘J’;
Str[4] = ’S’;
After changing the string index values, the value of str is ‘javascript’. What is the reason for this value:

A. Non-primitive values are mutable.


B. Non-primitive values are immutable.
C. Primitive values are mutable.
D. Primitive values are immutable.

Answer: D

NEW QUESTION 6
A developer has the following array of student test grades: Let arr = [ 7, 8, 5, 8, 9 ];
The Teacher wants to double each score and then see an array of the students who scored more than 15 points.
How should thedeveloper implement the request?

A. Let arr1 = arr.filter(( val) => ( return val > 15 )) .map (( num) => ( return num *2 ))
B. Let arr1 = arr.mapBy (( num) => ( return num *2 )) .filterBy (( val ) => return val > 15 )) ;
C. Let arr1 = arr.map((num) => num*2). Filter (( val) => val > 15);
D. Let arr1 = arr.map((num) => ( num *2)).filterBy((val) => ( val >15 ));

Answer: C

NEW QUESTION 7
A developer creates an object where its properties should be immutable and prevent properties from being added or modified.
Which method shouldbe used to execute this business requirement ?

A. Object.const()
B. Object.eval()
C. Object.lock()
D. Object.freeze()

Answer: D

NEW QUESTION 8
A developer is creating a simple webpage with a button. When a userclicks 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 every 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 02, use event.first to test if it is the first execution.


B. On line 04, useevent.stopPropagation ( ),
C. On line 04, use button.removeEventListener(‘ click” , listen);
D. On line 06, add an option called once to button.addEventListener().

Answer: CD

NEW QUESTION 9
A class was written to represent items for purchase in an online store, and a second class Representing items that are on sale at a discounted price. THe
constructor sets the name to the first value passed in. The pseudocode is below:

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

There is a new requirement for a developer to implement a description method that will return a brief description for Item and SaleItem.

What is the output when executing the code above ?

A. This is a ScarfUncaught TypeError:saleItem.description is not a function This is aScarfThis is a discounted Shirt


B. This is a Scarf This is a Shirt This is a ScarfThis is a discounted Shirt
C. This is a Scarf This is a ShirtThis is a discounted Scarf This is a discounted Shirt
D. Thisis aScarfUncaught TypeError: saleItem.description is not a function This is a ShirtThis is a did counted Shirt

Answer: B

NEW QUESTION 10
Refer to code below:
Function muFunction(reassign){
Let x = 1;
var y = 1;
if( reassign ) {
Let x= 2;
Var y = 2;
console.log(x);
console.log(y);}
console.log(x);
console.log(y);}
What isdisplayed when myFunction(true) is called?

A. 2 2 1 1
B. 2 2 undefined undefined
C. 2 2 1 2
D. 2 2 2 2

Answer: C

NEW QUESTION 10
Which three browser specific APIs are available for developers to persist data between page loads ? Choose 3 answers

A. IIFEs
B. indexedDB
C. Global variables
D. Cookies
E. localStorage.

Answer: ABE

NEW QUESTION 13
A developer is setting up a new Node.js server with a client library that is built using events and callbacks. The library:
* Will establish aweb socket connection and handle receipt of messages to the server
* Will be imported with require, and made available with a variable called we.
The developer also wants to add error logging if a connection fails.
Given this info, which code segment shows the correct way to set up a client with two events that listen at execution time?

A.

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

B.

C.

D.

Answer: C

NEW QUESTION 14
A Developer wrote the following code to test a sum3 function that takes in an array of numbers and returns the sum of the first three number in the array, The test
passes:

A different developer made changes to the behavior of sum3 to instead sum all of the numbers present in the array. The test passes:
Which two results occur when running the test on the updated sum3 function ? Choose 2 answers

A. The line 02 assertion passes.


B. The line 02 assertion fails
C. The line 05 assertion passes.
D. The line 05 assertion fails.

Answer: AD

NEW QUESTION 19
A developer needs to test this function:
01const sum3 = (arr) => (
02if (!arr.length) return 0,
03if (arr.length === 1) return arr[0],
04if (arr.length === 2) return arr[0]+ arr[1],
05 return arr[0] + arr[1] + arr[2],
06 );
Which two assert statements are valid tests for the function? Choose 2 answers

A. console.assert(sum3(1, ‘2’)) == 12);


B. console.assert(sum3(0)) == 0);
C. console.assert(sum3(-3, 2 )) == -1);
D. console.assert(sum3(‘hello’, 2, 3, 4)) === NaN);

Answer: AC

NEW QUESTION 20

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

A developer wrote the following codeto test a sum3 function that takes in an array of numbers and returns the sum of the first three numbers in the array, and the
test passes.
A different developer made changes to the behavior of sum3 to instead sum only the first two numbers present in thearray.

Which two results occur when running this test on the updated sum3 function? Choose 2 answers

A. The line 05 assertion passes.


B. The line 02 assertion passes.
C. The line 02 assertion fails.
D. The line 05 assertion fails.

Answer: BD

NEW QUESTION 24
Refer to the HTML below:
<div id=”main”>
<ul>
<li>Leo</li>
<li>Tony</li>
<li>Tiger</li>
</ul>
</div>
Which JavaScript statementresults in changing “ Tony” to “Mr. T.”?

A. document.querySelectorAll(‘$main $TONY’).innerHTML = ’ M
B. ’;
C. document.querySelector(‘$main li:second-child’).innerHTML = ’ M
D. ’;
E. document.querySelector(‘$main li.Tony’).innerHTML = ’ M
F. ’;
G. document.querySelector(‘$main li:nth-child(2)’),innerHTML = ’ M
H. ’;

Answer: D

NEW QUESTION 27
Refer to the code below:
1 let car1 = new promise((_, reject) =>
2 setTimeout(reject, 2000, “Car 1 crashed in”));
3 let car2 = new Promise(resolve => setTimeout(resolve, 1500, “Car 2 completed”));
4 let car3 = new Promise(resolve => setTimeout (resolve, 3000, “Car 3 Completed”));
5 Promise.race([car1, car2, car3]) 06 .then(value => (
07 let result = $(value) the race. `; 08 ))
9 catch( arr => (
10 console.log(“Race is cancelled.”, err); 11 ));
What is the value of result when Promise.race executes?

A. Car 3 completed the race.


B. Car 1 crashed in the race.
C. Car 2 completed the race.
D. Race is cancelled.

Answer: C

NEW QUESTION 30
Given the following code: Let x =null; console.log(typeof x);
What is the output of the line 02?

A. “Null”
B. “X”
C. “Object”
D. “undefined”

Answer: C

NEW QUESTION 33
Referto the code below: Const pi = 3.1415326, What is the data type of pi?

A. Double
B. Number
C. Decimal
D. Float

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

Answer: B

NEW QUESTION 34
A developer wants to iterate through an array of objects and count the objects and count the objects whose property value, name, starts with the letter N.
Const arrObj = [{“name” : “Zach”} , {“name” : “Kate”},{“name” : “Alise”},{“name” : “Bob”},{“name” : “Natham”},{“name” : “nathaniel”}
Refer to the code snippet below: 01 arrObj.reduce(( acc, curr) => { 02 //missing line 02
2 //missing line 03
04 ).0);
Which missing lines 02 and 03 return the correct count?

A. Mastered
B. Not Mastered

Answer: A

Explanation:
Explanation

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

A. const retrieveFromLocalStorage = () =>{return JSON.stringify(window.localStorage.getItem(storageKey));}

B. const retrieveFromLocalStorage = (storageKey) =>{ return window.localStorage.getItem(storageKey);}

C. const retrieveFromLocalStorage = (storageKey) =>{ returnJSON.parse(window.localStorage.getItem(storageKey));}

D. const retrieveFromLocalStorage = (storageKey) =>{ return window.localStorage[storageKey];}

Answer: C

NEW QUESTION 39
Refer to the code below:

Line 05 causes an error.


What are the values of greeting and salutation once code completes?

A. Greeting is Hello and salutation is Hello, Hello.


B. Greeting is Goodbye and salutation is Hello, Hello.
C. Greeting is Goodbye and salutation is I say Hello.
D. Greeting is Hello and salutation is I say hello.

Answer: A

NEW QUESTION 41
A developer wrote the following code: 01 let X = object.value;
02
3 try {
4 handleObjectValue(X); 05 } catch (error) {
6 handleError(error);
7}
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 thisbehavior?

A. 03 try{4 handleObjectValue(x);5 } catch(error){6 handleError(error); 07 } then {8 getNextValue();9 }


B. 03 try{4 handleObjectValue(x);5 } catch(error){6 handleError(error); 07 } finally {08 getNextValue();10 }
C. 03 try{04handleObjectValue(x); 05 } catch(error){6 handleError(error);7 }8 getNextValue();
D. 03 try {04 handleObjectValue(x)05 ……………………

Answer: D

NEW QUESTION 43
A developer writers the code below to calculate the factorial of a given number.

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

What isthe result of executing line 04?

A. 6
B. -Infinity
C. RuntimeError

Answer: D

Explanation:

NEW QUESTION 47
Given the code below: Setcurrent URL ();
console.log(‘The current URL is: ‘ +url ); function setCurrentUrl() {
Url = window.location.href:
What happens when the code executes?

A. The url variable has local scope and line 02 throws an error.
B. The url variable has global scope and line 02 executes correctly.
C. The url variable has global scope and line 02 throws an error.
D. The url variable has local scope and line 02 executes correctly.

Answer: B

NEW QUESTION 48
developer publishes a new version of a package with new features that do not break backward compatibility. The previous version number was 1.1.3.
Following semantic versioning format, what should the new package version number be?

A. 2.0.0
B. 1.2.3
C. 1.1.4
D. 1.2.0

Answer: D

NEW QUESTION 50
Refer to the code below:

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

A. Async runParallel () .then(data);


B. runParallel ( ). done(function(data){ return data;});
C. runParallel () .then(data);
D. runParallel () .then(function(data) return data

Answer: BD

NEW QUESTION 52
Given the following code: Let x =(‘15’ + 10)*2;
What is the value of a?

A. 3020

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

B. 1520
C. 50
D. 35

Answer: A

NEW QUESTION 53
Refer to following code block:
Let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,];
Let output =0;
For (let num of array){ if (output >0){
Break;
}
if(num % 2 == 0){
Continue;
}
Output +=num;
What is the value of output after the code executes?

A. 16
B. 36
C. 11
D. 25

Answer: A

NEW QUESTION 54
Refer to the code below? LetsearchString = ‘ look for this ’;
Which two options remove the whitespace from the beginning of searchString? Choose 2 answers

A. searchString.trimEnd();
B. searchString.trimStart();
C. trimStart(searchString);
D. searchString.replace(/*\s\s*/, ‘’);

Answer: BD

NEW QUESTION 55
Refer to the following object:

How can a developer access the fullName property for cat?

A. cat.fullName
B. cat.fullName()
C. cat.get.fullName
D. cat.function.fullName()

Answer: A

NEW QUESTION 59
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 to execute a script that removes all the element containing the class ad-library-item.
C. Use the DOM inspector to remove all the elements containing the class ad-library-item.
D. Use the browser console to execute a script that prevents the load event to be fired.

Answer: B

NEW QUESTION 62
Refer to the code below: function changeValue(param) { Param =5;
}

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

Let a =10;
Let b =5; changeValue(b);
Const result = a+ “ - ”+ b;
What is the value of result when code executes?

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

Answer: A

NEW QUESTION 67
Refer to the following code:

What is the output line 11?

A. [1,2]
B. [“bar”,”foo”]
C. [“foo”,”bar”]
D. [“foo:1”,”bar:2”]

Answer: C

NEW QUESTION 69
Refer to the code below:

After running this code, which result is displayed on the console?

A. > true > false


B. > 5 >undefined
C. > 5 > -1
D. >5 > 0

Answer: B

Explanation:

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

NEW QUESTION 73
Refer to the code snippet below:
Let array = [1, 2, 3, 4,4, 5, 4, 4];
For (let i =0; i < array.length; i++){ if (array[i] === 4) {
array.splice(i, 1);
}
}

What is the value of the array after the code executes?

A. [1, 2, 3, 4, 5, 4, 4]
B. [1, 2, 3, 4, 4, 5, 4]
C. [1, 2, 3, 4, 5, 4]
D. [1, 2, 3, 5]

Answer: C

NEW QUESTION 74
Refer to code below: console.log(0);
setTimeout(() => ( console.log(1);
});
console.log(2); setTimeout(() => { console.log(3);
), 0);
console.log(4);
In which sequence will the numbers be logged?

A. 01234
B. 02431
C. 02413
D. 13024

Answer: C

NEW QUESTION 77
A developer creates a class that represents a blog post based on the requirement that a Post should have a body author and view count.

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

The Code shown Below: ClassPost {


// Insert code here This.body =body This.author = author;
this.viewCount = viewCount;
}
}
Which statement should be inserted in the placeholder on line 02 to allow for a variable to be set to a new instanceof a Post with the three attributes correctly
populated?

A. super (body, author, viewCount) {


B. Function Post (body, author, viewCount) {
C. constructor (body, author, viewCount) {
D. constructor() {

Answer: C

NEW QUESTION 82
The developer wants to test the array shown: const arr = Array(5).fill(0)
Which two tests are the most accurate for this array ? Choose 2 answers:

A. console.assert( arr.length === 5 );


B. arr.forEach(elem => console.assert(elem === 0)) ;
C. console.assert(arr[0] === 0 && arr[ arr.length] === 0);
D. console.assert (arr.length >0);

Answer: AB

NEW QUESTION 84
Refer to code below:

What are the values for first and second once the code executes ?

A. First is Who and second is When


B. First is why and second is where
C. First is who and second is where
D. First is why andsecond is when

Answer: D

NEW QUESTION 86
developer uses the code below to format a date.

After executing, what is the value offormattedDate?

A. May 10, 2020


B. June 10, 2020
C. October 05, 2020
D. November 05, 2020

Answer: A

NEW QUESTION 90
A developer wants to setup a secure web server with Node.js. The developer creates a directory locally called app-server, and the first file is app-server/index.js
Without using any third-party libraries, what should the developer add to index.js to create the secure web server?

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

A. const https =require(‘https’);


B. const server =require(‘secure-server’);
C. const tls = require(‘tls’);
D. const http =require(‘http’);

Answer: A

NEW QUESTION 91
Which codestatement below correctly persists an objects in local Storage ?

A. const setLocalStorage = (storageKey, jsObject) => { window.localStorage.setItem(storageKey, JSON.stringify(jsObject));}


B. const setLocalStorage = ( jsObject) => { window.localStorage.connectObject(jsObject));}
C. const setLocalStorage = ( jsObject) => { window.localStorage.setItem(jsObject);}
D. const setLocalStorage = (storageKey, jsObject) => { window.localStorage.persist(storageKey, jsObject);}

Answer: A

NEW QUESTION 92
Refer to the code below:

Why does the function bar have access to variable a ?

A. Inner function’s scope


B. Hoisting
C. Outer function’s scope
D. Prototype chain

Answer: C

NEW QUESTION 96
is below:
<input type=”file” onchange=”previewFile()”>
<img src=”” height=”200” alt=”Image Preview…”/> The JavaScript portion is:
1 function previewFile(){
2 const preview = document.querySelector(‘img’);
3 const file = document.querySelector(‘input[type=file]’).files[0]; 04 //line 4 code
05 reader.addEventListener(“load”, () =>{ 06 preview.src = reader.result;
7 },false);
8 //line 8 code
9}
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) URL.createObjectURL(file);


B. 04 const reader = new FileReader();08 if (file) URL.createObjectURL(file);
C. 04 const reader = new File();08 if (file) reader.readAsDataURL(file);
D. 04 const reader = new FileReader();08 if (file) reader.readAsDataURL(file);

Answer: D

NEW QUESTION 101


A test has a dependency on database.query. During the test the dependency is replaced with an object called database with the method, query, that returns an
array. The developer needs to verify how many times the method was called and the arguments used each time.
Which two test approaches describe the requirement? Choose 2 answers

A. Integration
B. Black box
C. White box
D. Mocking

Answer: CD

NEW QUESTION 104


Refer to the code below:
Let inArray =[ [ 1, 2 ] , [ 3, 4, 5 ] ];
Which two statements result in the array [1, 2, 3, 4, 5] ?
Choose 2 answers

A. [ ]. Concat.apply ([ ], inArray);
B. [ ]. Concat (... inArray);

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

C. [ ]. concat.apply(inArray, [ ]);
D. [ ]. concat ( [ ….inArray ] );

Answer: AB

NEW QUESTION 105


A developer wrote a fizzbuzz function that when passed in a number, returns the following:
‘Fizz’ if the number is divisible by 3. ‘Buzz’ if the number is divisible by 5.
‘Fizzbuzz’ if the number is divisible by both 3 and 5. Emptystring if the number is divisible by neither 3 or 5.
Which two test cases will properly test scenarios for the fizzbuzz function? Choose 2 answers

A. let res = fizzbuzz(5); console.assert ( res === ‘ ’ );


B. let res = fizzbuzz(15);console.assert ( res ===‘ fizzbuzz ’ )
C. let res = fizzbuzz(Infinity); console.assert ( res === ‘ ’ )
D. let res = fizzbuzz(3); console.assert ( res === ‘ buzz ’ )

Answer: BCD

NEW QUESTION 106


A developer wants to create an object from a function in the browser using the code below:
Function Monster() { this.name =‘hello’ }; Const z = Monster();
What happens due to lack of the new keyword on line 02?

A. The z variable is assigned the correct object.


B. The z variable is assigned the correct object but this.name remains undefined.
C. Window.name is assigned to ‘hello’ and the variable z remains undefined.
D. Window.m is assigned the correct object.

Answer: C

NEW QUESTION 109


Why would a developer specify a package.jason as a developed forge instead of a dependency ?

A. It is required by the application in production.


B. It is only needed for local development and testing.
C. Other requiredpackages depend on it for development.
D. It should be bundled when the package is published.

Answer: B

NEW QUESTION 110


A developer creates a simple webpage with an input field. Whena user enters text in
the input field and clicks the button, the actual value of the field must be displayed in the console.
Here is the HTML file content:
<input type =” text” value=”Hello” name =”input”>
<button type =”button” >Display </button> The developer wrote the javascript code below:
Const button = document.querySelector(‘button’); button.addEvenListener(‘click’, () => (
Const input = document.querySelector(‘input’); console.log(input.getAttribute(‘value’));
When the user clicks the button, the output is always “Hello”. What needs to be done make this code work as expected?

A. Replace line 04 with console.log(input .value);


B. Replace line 03 with const input = document.getElementByName(‘input’);
C. Replace line 02 with button.addEventListener(“onclick”, function() {
D. Replace line 02 with button.addCallback(“click”, function() {

Answer: A

NEW QUESTION 112


A developer is working on an ecommerce website where the delivery date is dynamically calculated based on the current day. The code line below is responsible
for this calculation. Const deliveryDate = new Date ();
Due to changes in the business requirements, the delivery date must now be today’s date + 9 days.
Which code meets thisnew requirement?

A. deliveryDate.setDate(( new Date ( )).getDate () +9);


B. deliveryDate.setDate( Date.current () + 9);
C. deliveryDate.date = new Date(+9) ;
D. deliveryDate.date = Date.current () + 9;

Answer: A

NEW QUESTION 114


Which two console logs output NaN? Choose 2 answers | |

A. console.log(10 / Number('5) ) ;
B. console.log(parseInt ' ("two')) ;
C. console.log(10 / 0);
D. console.loeg(10 / 'five');

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

Answer: BD

NEW QUESTION 115


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 runningline 05?

A. aPromise and bPromise run sequentially.


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

Answer: B

NEW QUESTION 120


Which statement parses successfully?

A. JSO
B. parse (""foo"');
C. JSON.parse (""foo'");
D. JSON.parse ("foo");
E. JSON.parse ("foo");

Answer: A

NEW QUESTION 124


Refer to the following code that performs a basic mathematical operation on a provided input:
function calculate(num) { Return (num +10) / 3;
}
How should line 02 be written to ensure thatx evaluates to 6 in the line below? Let x = calculate (8);

A. Return Number((num +10) /3 );


B. Return (Number (num +10 ) / 3;
C. Return Integer(num +10) /3;
D. Return Number(num + 10) / 3;

Answer: B

NEW QUESTION 128


A developer has the function, shown below, that is called when a page loads.

Where can the developer see the log statement after loading the page in the browser?

A. Terminal running the web server.


B. Browser performance toots
C. Browser javaScript console
D. On the webpage.

Answer: C

NEW QUESTION 131


What are two unique features of functions defined with a fat arrow as compared to normal function definition?
Choose 2 answers

A. The function generated its own this making ituseful for separating the function’s scope from its enclosing scope.
B. The function receives an argument that is always in scope, called parentThis, which is the enclosing lexical scop
C. If the function has a single expression in the function body, the expression will be evaluated and implicit returned.
D. The function uses the this from the enclosing scope.

Answer: AC

NEW QUESTION 135


Consider type coercion, what does the following expression evaluate to? True + 3 + ‘100’ + null

A. 104
B. 4100
C. ‘3100null’
D. ‘4100null’

Answer: D

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

NEW QUESTION 139


Which statement accurately describes an aspect of promises?

A. Arguments for the callback function passed to .then() are optional.


B. In a.then() function, returning results is not necessary since callbacks will catch the result of a previous promise.
C. .then() cannot be added after a catch.
D. .then() manipulates and returns the original promise.

Answer: A

NEW QUESTION 142


A developer has code that calculates a restaurant bill, but generates incorrectanswers while testing the code:
function calculateBill ( items ) { let total = 0;
total += findSubTotal(items); total += addTax(total);
total += addTip(total); return total;
}
Which option allows the developer to step into each function execution within calculateBill?

A. Using the debugger command on line 05.


B. Using the debugger command on line 03
C. Calling the console.trace (total) method on line 03.
D. Wrapping findSubtotal in a console.log() method.

Answer: A

NEW QUESTION 143


A developer is debugging a web server that uses Node.js The server hits a runtimeerror every third request to an important endpoint on the web server.
The developer added a break point to the start script, that is at index.js at he root of the server’s source code. The developer wants to make use of chrome
DevTools to debug. Which command can be run to access DevTools and make sure the breakdown is hit ?

A. node -i index.js
B. Node --inspect-brk index.js
C. Node inspect index.js
D. Node --inspect index.js

Answer: D

NEW QUESTION 148


Which statement phrases successfully?

A. JSON.parse ( ‘ foo ’ );
B. JSON.parse ( “ foo ” );
C. JSON.parse( “ ‘ foo ’ ” );
D. JSON.parse(‘ “ foo ” ’);

Answer: D

NEW QUESTION 150


In which situation should a developer include a try .. catch block around their function call ?

A. The function has an error that shouldnot be silenced.


B. The function results in an out of memory issue.
C. The function might raise a runtime error that needs to be handled.
D. The function contains scheduled code.

Answer: C

NEW QUESTION 155


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 typeBoolean ?
Choose 2 answers:

A. Boolean(var1 && var2)


B. var1 && var2
C. var1.toBoolean() && var2toBoolean()
D. Boolean(var1) && Boolean(var2)

Answer: AD

NEW QUESTION 158


Given the following code: Counter = 0;
const logCounter = () => { console.log(counter);
);
logCounter(); setTimeout(logCOunter, 1100); setInterval(() => {
Counter++ logCounter();
}, 1000);
What is logged by the first four log statements?

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

A. 0 0 1 2
B. 0 1 2 3
C. 0 1 1 2
D. 0 1 2 2

Answer: C

NEW QUESTION 160


Refer to the following code that imports a module named utils:

Which two implementations of Utils.js export foo and bar such that the code above runs without error?
Choose 2 answers

A.

B.

C.

D.

Answer: BC

NEW QUESTION 162


Refer to the code below:
Async funct on functionUnderTest(isOK) { If (isOK) return ‘OK’ ;
Throw new Error(‘not OK’);
)
Which assertion accuretely tests the above code?

A. Console.assert (await functionUnderTest(true), ‘ OK ’)


B. Console.assert (await functionUnderTest(true), ‘ not OK ’)
C. Console.assert (awaitfunctionUnderTest(true), ‘ not OK ’)
D. Console.assert (await functionUnderTest(true), ‘OK’)

Answer: D

NEW QUESTION 165


In the browser, the window object is often used to assign variables that require the broadest scope in an application Node.js application does not have access to
the window object by default.
Which two methods are used to address this ? Choose 2 answers

A. Use the document object instead of the window object.


B. Assign variables to the global object.
C. Create a new window object in the root file.
D. Assign variablesto module.exports and require them as needed.

Answer: B

NEW QUESTION 170


Refer to the following array:
Let arr1 = [ 1, 2, 3, 4, 5 ];

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

Which two lines of code result in a second array, arr2 being created such that arr2 is not a reference to arr1?

A. Let arr2 = arr1.slice(0, 5);


B. Let arr2 = Array.from(arr1);
C. Letarr2 = arr1;
D. Let arr2 = arr1.sort();

Answer: AB

NEW QUESTION 174


......

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Recommend!! Get the Full JavaScript-Developer-I dumps in VCE and PDF From SurePassExam
https://www.surepassexam.com/JavaScript-Developer-I-exam-dumps.html (219 New Questions)

Thank You for Trying Our Product

We offer two products:

1st - We have Practice Tests Software with Actual Exam Questions

2nd - Questons and Answers in PDF Format

JavaScript-Developer-I Practice Exam Features:

* JavaScript-Developer-I Questions and Answers Updated Frequently

* JavaScript-Developer-I Practice Questions Verified by Expert Senior Certified Staff

* JavaScript-Developer-I Most Realistic Questions that Guarantee you a Pass on Your FirstTry

* JavaScript-Developer-I Practice Test Questions in Multiple Choice Formats and Updatesfor 1 Year

100% Actual & Verified — Instant Download, Please Click


Order The JavaScript-Developer-I Practice Test Here

Passing Certification Exams Made Easy visit - https://www.surepassexam.com


Powered by TCPDF (www.tcpdf.org)

You might also like