Given the JavaScript below:
01 function filterDOM (searchString) {
02 const parsedSearchString = searchString && searchString.toLowerCase() ;
03 document.quesrySelectorAll(‘ .account’ ) . forEach(account => (
04 const accountName = account.innerHTML.toLOwerCase();
05 account. Style.display = accountName.includes(parsedSearchString) ? /*Insert
code*/;
06 )};
07 }
Which code should replace the placeholder comment on line 05 to hide accounts that do
not match the search string?
Refer to the code below:
01 const exec = (item, delay) =>{
02 new Promise(resolve => setTimeout( () => resolve(item), delay)),
03 async function runParallel() {
04 Const (result1, result2, result3) = await Promise.all{
05 [exec (‘x’, ‘100’) , exec(‘y’, 500), exec(‘z’, ‘100’)]
06 );
07 return `parallel is done: $(result1) $(result2)$(result3)`;
08 }
}
}
Which two statements correctly execute the runParallel () function?
Choose 2 answers
Refer to the HTML below:
Which JavaScript statement results in changing “ The Lion.”?
Given the following code:
document.body.addEventListener(‘ click ’, (event) => {
if (/* CODE REPLACEMENT HERE */) {
console.log(‘button clicked!’);
)
});
Which replacement for the conditional statement on line 02 allows a developer to
correctly determine that a button on page is clicked?
Which code statement below correctly persists an objects in local Storage ?
Given the code below:
What is logged to the console'
Refer to HTML below:
contents.
Which expression outputs the screen width of the element with the ID card-01?
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 developer is wondering whether to use, Promise.then or Promise.catch, especially
when a Promise throws an error?
Which two promises are rejected?
Which 2 are correct?
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?
Given the following code:
What is the output of line 02?
A developer implements and calls the following code when an application state change occurs:
Const onStateChange =innerPageState) => {
window.history.pushState(newPageState, ‘ ’, null);
}
If the back button is clicked after this method is executed, what can a developer expect?
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?
Refer to the code below:
const car = {
price:100,
getPrice:function(){
return this.price;
}
};
const customCar = Object.create(car);
customCar.price = 70;
delete customCar.price;const result = customCar.getPrice();
What is the value of result after the code executes?
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 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 the array.
Which two results occur when running this test on the updated sum3 function?
Choose 2 answers
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
Given the code below:
Which method can be used to provide a visual representation of the list of users and to allow sorting by the name or email attribute?
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
02 //missing line 03
04 ). 0);
Which missing lines 02 and 03 return the correct count?
A developer is setting up a Node,js server and is creating a script at the root of the source code, index,js, that will start the server when executed. The developer declares a variable that needs the folder location that the code executes from.
Which global variable can be used in the script?
Given the following code:
Let x =null;
console.log(typeof x);
What is the output of the line 02?
A developer is leading the creation of a new browser application that will serve a single
page application. The team wants to use a new web framework Minimalsit.js. The Lead
developer wants to advocate for a more seasoned web framework that already has a
community around it.
Which two frameworks should the lead developer advocate for?
Choose 2 answers
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
Refer to the following code:
What is the value of output on line 11?
The developer has a function that prints “Hello” to an input name. To test this, thedeveloper created a function that returns “World”. However the following snippet does not print “ Hello World”.
What can the developer do to change the code to print “Hello World” ?
A developer creates an object where its properties should be immutable and prevent
properties from being added or modified.
Which method should be used to execute this business requirement ?
A developer has an ErrorHandler module that contains multiple functions.
What kind of export should be leveraged so that multiple functions can be used?
Refer to code below:
Let a =’a’;
Let b;
// b = a;
console.log(b);
What is displayed when the code executes?
A developer writes the code below to return a message to a user attempting to register a new username. If the username is available, a variable named nag is declared and assigned a value on line 03.
What is the value of msg when getAvailableabilityMessage (“newUserName”) is executed and get Availability (“newUserName”) returns true?
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
Cloud Kicks has a class to represent items for sale in an online store, as shown below:
Class Item{
constructor (name, price){
this.name = name;
this.price = price;
}
formattedPrice(){
return ‘s’ + String(this.price);}}
A new business requirement comes in that requests a ClothingItem class that should have all of
the properties and methods of the Item class but will also have properties that are specific to
clothes.
Which line of code properly declares the clothingItem class such that it inherits from
Item?
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 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
Given the following code:
is the output of line 02?