Salesforce Certified JavaScript Developer I (SU24) Questions and Answers
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 developer writers the code below to calculate the factorial of a given number.
Function factorial(number) {
Return number + factorial(number -1);
}
factorial(3);
What is the result of executing line 04?
Refer to the string below.
Const str=’Salesforce’;
Which two statements results in the word 'Sales'?
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?
Refer to the code below:
Line 05 causes an error.
What are the values of greeting and salutation once code completes?
A developer has a web server running with Node.js. The command to start the web server is node server.js. The web server started having
latency issues. Instead of a one second turnaround for web requests, the developer now sees a five second turnaround.
Which command can the web developer run to see what the module is doing during the latency period?
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 ?
Which code statement correctly retrieves and returns an object from localStorage?
Refer to the following code block:
What is the console output?
is below:
The JavaScript portion is:
01 function previewFile(){
02 const preview = document.querySelector(‘img’);
03 const file = document.querySelector(‘input[type=file]’).files[0];
04 //line 4 code
05 reader.addEventListener(“load”, () => {
06 preview.src = reader.result;
07 },false);
08 //line 8 code
09 }
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?
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:
Which code statement below correctly persists an objects in local Storage ?
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?
Which two options are core Node.js modules?
Choose 2 answers
Refer to the expression below:
Let x = (‘1’ + 2) == (6 * 2);
How should this expression be modified to ensure that evaluates to false?
bar, awesome is a popular JavaScript module. the versions publish to npm are:
Teams at Universal Containers use this module in a number of projects. A particular project has the package, json definition below.
A developer runs this command: npm install.
Which version of bar .awesome is installed?
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 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 ?
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.
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 developer has an ErrorHandler module that contains multiple functions.
What kind of export be leverages so that multiple functions can be used?
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?
Refer to the code below:
What is the value of result after line 10 executes?
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 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 following code:
What is the output of line 11?
Which three options show valid methods for creating a fat arrow function?
Choose 3 answers
Considering the implications of 'use strict' on line 04, which three statements describe the execution of the code?
Choose 3 answers
Refer the following code
what is the value of array after code executes?
Given the code below:
const copy = JSON.stringify([ new String(‘ false ’), new Bollean( false ), undefined ]);
What is the value of copy?
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
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 array after the code executes?
developer has a web server running with Node.js. The command to start the web
server is node server,js. The web server started having latency issues. Instead of a one second
turn around for web requests, the developer now sees a five second turnaround,
Which command can the web developer run to see what the module is doing during the
latency period?