Black Friday Biggest Discount Flat 70% Offer - Ends in 0d 00h 00m 00s - Coupon code: 70diswrap

Salesforce JavaScript-Developer-I Dumps

Salesforce Certified JavaScript Developer I (SU24) Questions and Answers

Question 1

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

Options:

A.

Vue

B.

Angular

C.

Koa

D.

Express

Question 2

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?

Options:

A.

0

B.

6

C.

-Infinity

D.

RuntimeError

Question 3

Refer to the string below.

Const str=’Salesforce’;

Which two statements results in the word 'Sales'?

Options:

Question 4

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?

Options:

A.

const https =require(‘https’);

B.

const server =require(‘secure-server’);

C.

const tls = require(‘tls’);

D.

const http =require(‘http’);

Question 5

Refer to the code below:

as

Line 05 causes an error.

What are the values of greeting and salutation once code completes?

Options:

A.

Greeting is Hello and salutation is Hello, Hello.

B.

Greeting is Goodbye and salutation is Hello, Hello.

C.

Greeting is Goodbye and salutation is I say Hello.

D.

Greeting is Hello and salutation is I say hello.

Question 6

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?

Options:

A.

NODE_DEBUG=true node server.js

B.

DEBUG=http, https node server.js

C.

NODE_DEBUG=http,https node server.js

D.

DEBUG=true node server.js

Question 7

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 ?

Options:

A.

node -i index.js

B.

Node --inspect-brk index.js

C.

Node inspect index.js

D.

Node --inspect index.js

Question 8

Which code statement correctly retrieves and returns an object from localStorage?

Options:

A.

const retrieveFromLocalStorage = () =>{

return JSON.stringify(window.localStorage.getItem(storageKey));

}

B.

const retrieveFromLocalStorage = (storageKey) =>{

return window.localStorage.getItem(storageKey);

}

C.

const retrieveFromLocalStorage = (storageKey) =>{

return JSON.parse(window.localStorage.getItem(storageKey));

}

D.

const retrieveFromLocalStorage = (storageKey) =>{

return window.localStorage[storageKey];

}

Question 9

Refer to the following code block:

as

What is the console output?

Options:

A.

> Better student Jackie got 70% on test.

B.

> Jackie got 70% on test.

C.

> Uncaught Reference Error

D.

> Better student Jackie got 100% on test.

Question 10

is below:

as

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?

Options:

A.

04 const reader = new File();

08 if (file) URL.createObjectURL(file);

B.

04 const reader = new FileReader();

08 if (file) URL.createObjectURL(file);

C.

04 const reader = new File();

08 if (file) reader.readAsDataURL(file);

D.

04 const reader = new FileReader();

08 if (file) reader.readAsDataURL(file);

Question 11

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:

Options:

A.

Installs with its own package manager to install and manage third-party libraries.

B.

Ensures stability with one major release every few years.

C.

Performs a static analysis on code before execution to look for runtime errors.

D.

Executes server-side JavaScript code to avoid learning a new language.

E.

Uses non-blocking functionality for performant request handling .

Question 12

Which code statement below correctly persists an objects in local Storage ?

Options:

A.

const setLocalStorage = (storageKey, jsObject) => {

window.localStorage.setItem(storageKey, JSON.stringify(jsObject));

}

B.

const setLocalStorage = ( jsObject) => {

window.localStorage.connectObject(jsObject));

}

C.

const setLocalStorage = ( jsObject) => {

window.localStorage.setItem(jsObject);

}

D.

const setLocalStorage = (storageKey, jsObject) => {

window.localStorage.persist(storageKey, jsObject);

}

Question 13

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?

Options:

A.

‘ name ’ : ‘ block ’

B.

‘ Block ’ : ‘ none ’

C.

‘ visible ’ : ‘ hidden ’

D.

‘ hidden ’ : ‘ visible ’

Question 14

Which two options are core Node.js modules?

Choose 2 answers

Options:

A.

worker

B.

isotream

C.

exception

D.

http

Question 15

Refer to the expression below:

Let x = (‘1’ + 2) == (6 * 2);

How should this expression be modified to ensure that evaluates to false?

Options:

A.

Let x = (‘1’ + ‘ 2’) == ( 6 * 2);

B.

Let x = (‘1’ + 2) == ( 6 * 2);

C.

Let x = (1 + 2) == ( ‘6’ / 2);

D.

Let x = (1 + 2 ) == ( 6 / 2);

Question 16

bar, awesome is a popular JavaScript module. the versions publish to npm are:

as

Teams at Universal Containers use this module in a number of projects. A particular project has the package, json definition below.

as

A developer runs this command: npm install.

Which version of bar .awesome is installed?

Options:

A.

1.3.1

B.

1.3.5

C.

The command fails, because version 130 is not found

D.

1.4.0

Question 17

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?

Options:

A.

100

B.

undefined

C.

null

D.

70

Question 18

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 ?

Options:

A.

Object.const()

B.

Object.eval()

C.

Object.lock()

D.

Object.freeze()

Question 19

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:

as

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.

Options:

A.

Use the DOM inspector to prevent the load event to be fired.

B.

Use the browser to execute a script that removes all the element containing the class ad-library-item.

C.

Use the DOM inspector to remove all the elements containing the class ad-library-item.

D.

Use the browser console to execute a script that prevents the load event to be fired.

Question 20

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:

Options:

A.

console.assert( arr.length === 5 );

B.

arr.forEach(elem => console.assert(elem === 0)) ;

C.

console.assert(arr[0] === 0 && arr[ arr.length] === 0);

D.

console.assert (arr.length >0);

Question 21

A developer has an ErrorHandler module that contains multiple functions.

What kind of export be leverages so that multiple functions can be used?

Options:

A.

Named

B.

All

C.

Multi

D.

Default

Question 22

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?

Options:

A.

01 let monthName =’July’;

B.

02 let year =2019;

C.

02 const year = 2020;

D.

03 if (year == 2019) {

Question 23

Refer to the code below:

as

What is the value of result after line 10 executes?

Options:

A.

Error: myFather.job is not a function

B.

John Developer

C.

undefined Developer

D.

John undefined

Question 24

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?

Options:

A.

“Username available”

B.

“newUserName”

C.

“Msg is not defined”

D.

undefined

Question 25

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

Options:

A.

Console16bit.prototype.load(gamename) = function() {

B.

Console16bit.prototype.load = function(gamename) {

C.

Console16bit = Object.create(GameConsole.prototype).load = function

(gamename) {

D.

Console16bit.prototype.load(gamename) {

Question 26

Refer to the following code:

as

What is the output of line 11?

Options:

A.

[1,2]

B.

["bar", "foo"]

C.

["foo:1", "bar:2"]

D.

["foo", "bar"]

Question 27

Which three options show valid methods for creating a fat arrow function?

Choose 3 answers

Options:

A.

x => ( console.log(‘ executed ’) ; )

B.

[ ] => ( console.log(‘ executed ’) ;)

C.

( ) => ( console.log(‘ executed ’) ;)

D.

X,y,z => ( console.log(‘ executed ’) ;)

E.

(x,y,z) => ( console.log(‘ executed ’) ;)

Question 28

Considering the implications of 'use strict' on line 04, which three statements describe the execution of the code?

Choose 3 answers

Options:

A.

z is equal to 3.14.

B.

'use strict' is hoisted, so it has an effect on all lines.

C.

'use strict' has an effect only on line 05.

D.

'use strict' has an effect between line 04 and the end of the file.

E.

Line 05 throws an error.

Question 29

Refer the following code

as

what is the value of array after code executes?

Options:

Question 30

Given the code below:

const copy = JSON.stringify([ new String(‘ false ’), new Bollean( false ), undefined ]);

What is the value of copy?

Options:

A.

-- [ \”false\” , { } ]--

B.

-- [ false, { } ]--

C.

-- [ \”false\” , false, undefined ]--

D.

-- [ \”false\” ,false, null ]--

Question 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

Options:

A.

var1 + var2

B.

var1.toString ( ) var2.toString ( )

C.

String (var1) .concat (var2)

D.

string.concat (var1 +var2)

Question 32

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?

Options:

A.

[1, 2, 3, 4, 5, 4, 4]

B.

[1, 2, 3, 4, 4, 5, 4]

C.

[1, 2, 3, 5]

D.

[1, 2, 3, 4, 5, 4]

Question 33

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?

Options:

A.

DEBUG = http, https node server.js

B.

NODE_DEBUG =http, https node server.js

C.

DEBUG =true node server.js

D.

NODE_DEBUG =true node server.js

Page: 1 / 22
Total 215 questions