JavaScript-Developer-I Dumps with Practice Exam Questions Answers [Q12-Q35]

Rate this post

JavaScript-Developer-I Dumps with Practice Exam Questions Answers

JavaScript-Developer-I by Salesforce Developer Actual Free Exam Practice Test

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

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

 
 
 
 

NO.13 developer is trying to convince management that their team will benefit from using
Node.js for a backend server that they are going to create. The server will be a web server that
handles API requests from a website that the team has already built using HTML, CSS, and
JavaScript.
Which three benefits of Node.js can the developer use to persuade their manager?
Choose 3 answers:

 
 
 
 
 

NO.14 Refer to the code below:

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

 
 
 
 

NO.15 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?

 
 
 
 

NO.16 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

 
 
 
 

NO.17 Refer to the following array:
Let arr1 = [1, 2, 3, 4, 5];
Which two lines of codes result in a second array, arr2, being created such that arr2 is not a reference to arr1? Choose 2 answers

 
 
 
 

NO.18 Refer to the following code:

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

 
 
 
 

NO.19 developer uses the code below to format a date.

After executing, what is the value of formattedDate?

 
 
 
 

NO.20 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.
Const sumFunction = arr => {
Return arr.reduce((result, current) => {
//
Result += current;
//
), 10);
);
Which option makes the code work as expected?

 
 
 
 

NO.21 A developer writes the code below to calculate the factorial of a given number.

What is the result of executing line 04?

 
 
 
 

NO.22 Refer to code below:
Let first = ‘who’;
Let second = ‘what’;
Try{
Try{
Throw new error(‘Sad trombone’);
}catch (err){
First =’Why’;
}finally {
Second =’when’;
} catch (err) {
Second =’Where’;
}
What are the values for first and second once the code executes ?

 
 
 
 

NO.23 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

 
 
 
 
 

NO.24 Refer to the following object:
const cat ={
firstName: ‘Fancy’,
lastName: ‘ Whiskers’,
Get fullName() {
return this.firstName + ‘ ‘ + this.lastName;
}
};
How can a developer access the fullName property for cat?

 
 
 
 

NO.25 Refer to the code below?
Let searchString = ‘ look for this ‘;
Which two options remove the whitespace from the beginning of searchString?
Choose 2 answers

 
 
 
 

NO.26 A developer wants to use a module called DataPrettyPrint. This module exports one default function called printDate ().
How can a developer import and use the printDate() function?
A)

B)

C)

D)

 
 
 
 

NO.27 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?

 
 
 
 

NO.28 A developer has code that calculates a restaurant bill, but generates incorrect answers while testing the code.

Which option allows the developer to step into each function execution within calculateBill?

 
 
 
 

NO.29 Which option is true about the strict mode in imported modules?

 
 
 
 

NO.30 Refer the code below.
x=3.14;
function myfunction() {
“use strict”;
y=x;
}
z=x;
myFunction();

NO.31 Given the expressions var1 and var2, what are two valid ways to return the concatenation of the two expressions and ensure it is string? Choose 2 answers

 
 
 
 

NO.32 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

 
 
 
 

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

 
 
 
 

NO.34 Refer to the code below:
01 const server = require(‘server’);
02 /* Insert code here */
A developer imports a library that creates a web server. The imported library uses events and callbacks to start the servers Which code should be inserted at the line 03 to set up an event and start the web server ?

 
 
 
 
 

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

 
 
 
 

Free Salesforce Developer JavaScript-Developer-I Exam Question: https://www.premiumvcedump.com/Salesforce/valid-JavaScript-Developer-I-premium-vce-exam-dumps.html