Refer to the code snippet:
Function getAvailabilityMessage(item) {
If (getAvailability(item)){
Var msg =”Username available”;
}
Return msg;
}
A developer writes this code to return a message to user attempting 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?
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 type Boolean ?
Choose 2 answers:
A developer has code that calculates a restaurant bill, but generates incorrect answers
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?
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?
Given the JavaScript below:
Which code should replace the placeholder comment on line 05 to highlight accounts that match the search string'
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?
Given the code below:
const copy = JSON.stringify([ new String(‘ false ’), new Bollean( false ), undefined ]);
What is the value of copy?
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?
Which statement can a developer apply to increment the browser's navigation history without a page refresh?
Which statement can a developer apply to increment the browser's navigation history without a page refresh?
Refer to the string below:
const str = 'Salesforce';
Which two statements result in the word 'Sales'?
Choose 2 answers
Refer to the code below:
function changeValue(param) {
Param =5;
}
Let a =10;
Let b =5;
changeValue(b);
Const result = a+ “ - ”+ b;
What is the value of result when code executes?
Given code below:
setTimeout (() => (
console.log(1);
). 0);
console.log(2);
New Promise ((resolve, reject )) = > (
setTimeout(() => (
reject(console.log(3));
). 1000);
)).catch(() => (
console.log(4);
));
console.log(5);
What is logged to the console?
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 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?
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 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 developer has a formatName function that takes two arguments, firstName and lastName and returns a string. They want to schedule the
function to run once after five seconds.
What is the correct syntax to schedule this function?
What are two unique features of functions defined with a fat arrow as compared to normal function definition?
Choose 2 answers
At Universal Containers, every team has its own way of copying JavaScript objects. The code snippet shows an Implementation from one team:
What is the output of the code execution?
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:
Refer to the following array:
Let arr = [ 1,2, 3, 4, 5];
Which three options result in x evaluating as [3, 4, 5] ?
Choose 3 answers.
A team that works on a big project uses npm to deal with projects dependencies.
A developer added a dependency does not get downloaded when they execute npm
install.
Which two reasons could be possible explanations for this?
Choose 2 answers
Given the code below:
01 function GameConsole (name) {
02 this.name = name;
03 }
04
05 GameConsole.prototype.load = function(gamename) {
06 console.log( ` $(this.name) is loading a game : $(gamename) …`);
07 )
08 function Console 16 Bit (name) {
09 GameConsole.call(this, name) ;
10 }
11 Console16bit.prototype = Object.create ( GameConsole.prototype) ;
12 //insert code here
13 console.log( ` $(this.name) is loading a cartridge game : $(gamename) …`);
14 }
15 const console16bit = new Console16bit(‘ SNEGeneziz ’);
16 console16bit.load(‘ Super Nonic 3x Force ’);
What should a developer insert at line 15 to output the following message using the
method ?
> SNEGeneziz is loading a cartridge game: Super Monic 3x Force . . .
Refer to the code below:
const event = new CustomEvent(
//Missing Code
);
obj.dispatchEvent(event);
A developer needs to dispatch a custom event called update to send information about
recordId.
Which two options could a developer insert at the placeholder in line 02 to achieve this?
Choose 2 answers
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 ?
Refer to the code below
let inArray = [[1,2],[3,4,5]];
which two statements results in the array [1,2,3,4,5]?
choose 2 answer
Given the requirement to refactor the code above to JavaScript class format, which class
definition is correct?
A)
B)
C)
D)