100% Passing Guarantee - Brilliant JavaScript-Developer-I Exam Questions PDF [Feb-2023]
JavaScript-Developer-I Dumps 2023 - NewSalesforce JavaScript-Developer-I Exam Questions
NEW QUESTION 107
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.0
- C. 1.1.4
- D. 1.2.3
Answer: A
NEW QUESTION 108
A developer wants to use a module named universalContainersLib 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/universalContainersLib.js';
universalContainersLib. foo ()7
universalContainersLib.bar (); - B. import {foo,bar} from '/path/universalCcontainersLib.js';
foo():
bar()? - C. import all from '/path/universalContainersLib.js';
universalContainersLib.foo();
universalContainersLib.bar (); - D. import * as lib from '/path/universalContainersLib.js';
lib.foo();
lib. bar ();
Answer: D
NEW QUESTION 109
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 ?
- A. console.log( 'Listening on ', port) ;
- B. Server.start ();
- C. server.on(' connect ' , ( port) => {
console.log('Listening on ' , port) ;}) - D. server()
- E. serve(( port) => (
Answer: C
NEW QUESTION 110
Refer to the code below:
console.log(''start);
Promise.resolve('Success') .then(function(value){
console.log('Success');
});
console.log('End');
What is the output after the code executes successfully?
- A. Start
Success
End - B. Success
Start
End - C. Start
End
Success - D. End
Start
Success
Answer: C
NEW QUESTION 111
Given the JavaScript below:
Which code should replace the placeholder comment on line 05 to highlight accounts that match the search string'
- A. 'yellow' : null
- B. 'none1 : "yellow'
- C. null : 'yellow'
- D. 'yellow : 'none'
Answer: D
NEW QUESTION 112
Given the code below:
Which method can be provide a visual representation of the list if users and to allow sorting by the name or email attributes.
- A. Console.groupCollapsed (userslist);
- B. Console.info (userlist);
- C. Console.group (userList);
- D. Console,table (userslist);
Answer: C
NEW QUESTION 113
A developer has two ways to write a function:
Option A:
function Monster(){
this.growl = ()=>{
console.log('Grr!');
}
}
Option B:
function Monster(){};
Monster.prototype.growl = ()=>{
console.log('Grr!');
}
After deciding on an option, the developer creates 1000 monster objects.
How many growl methods are created with Option A and Option B?
- A. 1 methods for both
- B. 1 for Option A, 1000 for Option B
- C. 1000 for both
- D. 1000 for Option A, 1 for Option B
Answer: A
NEW QUESTION 114
Refer to the code below:
for(let number =2 ; number <= 5 ; number += 1 ) {
// insert code statement here
}
The developer needs to insert a code statement in the location shown. The code
statement has these requirements:
1. Does require an import
2. Logs an error when the boolean statement evaluates to false
3. Works in both the browser and Node.js
Which meet the requirements?
- A. console.error(number % 2 === 0);
- B. console.assert(number % 2 === 0);
- C. assert (number % 2 === 0);
- D. console.debug(number % 2 === 0);
Answer: A
NEW QUESTION 115
A developer wants to use a try...catch statement to catch any error that countSheep () may throw and pass it to a handleError () function.
What is the correct implementation of the try...catch?
A)
B)
C)
D)
- A. Option
- B. Option
- C. Option
- D. Option
Answer: D
NEW QUESTION 116
A developer is trying to handle an error within a function.
Which code segment shows the correct approach to handle an error without propagating it elsewhere?
A)
B)
C)
D)
- A. Option A
- B. Option C
- C. Option B
- D. Option D
Answer: D
NEW QUESTION 117
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. Window.name is assigned to 'hello' and the variable z remains undefined.
- B. Window.m is assigned the correct object.
- C. The z variable is assigned the correct object but this.name remains undefined.
- D. The z variable is assigned the correct object.
Answer: A
NEW QUESTION 118
Universal Containers (UC) notices that its application that allows users to search for
accounts makes a network request each time a key is pressed. This results in too many
requests for the server to handle.
● Address this problem, UC decides to implement a debounce function on string change
handler.
What are three key steps to implement this debounce function?
Choose 3 answers:
- A. Ensure that the network request has the property debounce set to true.
- B. When the search string changes, enqueue the request within a setTimeout.
- C. If there is an existing setTimeout and the search string changes, cancel the existing
setTimeout using the persisted timerId and replace it with a new setTimeout. - D. If there is an existing setTimeout and the search string change, allow the existing
setTimeout to finish, and do not enqueue a new setTimeout. - E. Store the timeId of the setTimeout last enqueued by the search string change handle.
Answer: A,B,D
NEW QUESTION 119
A developer implements and calls the following code when an application state change occurs:
If the back button is clicked after this method is executed, what can a developer expect?
- A. A popstate event is fired with a state properly that details the application's last state.
- B. A navigate event is fired with a state properly that details previous application state.
- C. The page reloads and all JavaScript is reinitialized.
- D. The page is navigated away from and previous page in the browser's history is loaded.
Answer: D
NEW QUESTION 120
A test has a dependency on database. query. During the test, the dependency is replaced with an object called database with the method, Calculator query, that returns an array. The developer does not need to verify how many times the method has been called.
Which two test approaches describe the requirement?
Choose 2 answers
- A. Substitution
- B. White box
- C. Stubbing
- D. Black box
Answer: A,B
NEW QUESTION 121
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?
- A. Car 1 crashed in the race.
- B. Car 3 completes the race
- C. Race is cancelled.
- D. Car 2 completed the race.
Answer: D
NEW QUESTION 122
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
- A. sampleText.includes('fox');
- B. sampleText.includes(' Fox ', 3)
- C. sampleText.includes(' quick ', 4);
- D. sampleText.includes(' fox ');
- E. sampleText.includes(' quick ') !== -1;
Answer: C,D,E
NEW QUESTION 123
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 is displayed when myFunction(true) is called?
- A. 2 2 2 2
- B. 2 2 1 1
- C. 2 2 1 2
- D. 2 2 undefined undefined
Answer: C
NEW QUESTION 124
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:
Let res = sum2([1, 2, 3 ]) ;
console.assert(res === 6 );
Res = sum3([ 1, 2, 3, 4]);
console.assert(res=== 6);
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 05 assertion fails.
- B. The line 02 assertion passes.
- C. The line 02 assertion fails
- D. The line 05 assertion passes.
Answer: A,B
NEW QUESTION 125
Refer to the following code:
class Vehicle{
constructor(plate){
this.plate = plate;
}
}
class Truck extends Vehicle{
constructor(plate, weight){
//Missing code
this.weight = weight;
}
displayWeight(){
console.log(`The truck ${this.plate} has a weight of ${this.weight}lb.`);
}
}let myTruck = new Truck('123Ab',5000);
myTruck.displayWeight();
Which statement should be added to missing code for the code to display 'The truck 123AB has a weight of 5000lb.
- A. Vehicle.plate = plate
- B. super.plate = plate
- C. this.plate = plate
- D. super(plate)
Answer: D
NEW QUESTION 126
A developer wants to set up 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?
- A. const server =require('secure-server');
- B. const tls = require('tls');
- C. const http =require('http');
- D. const https =require('https');
Answer: D
NEW QUESTION 127
Considering type coercion, what does the following expression evaluate to?
True + '13' + NaN
- A. 0
- B. ' true13 '
- C. ' true13NaN '
- D. ' 113Nan '
Answer: C
NEW QUESTION 128
......
Free JavaScript-Developer-I braindumps download: https://dumpstorrent.prep4surereview.com/JavaScript-Developer-I-latest-braindumps.html
