Spring Sale Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: pass65

JavaScript-Developer-I Salesforce Certified JavaScript Developer JS-Dev-101 Questions and Answers

Questions 4

myArraym can have one level, two levels, or more levels.

Which statement flattens myArray when it can be arbitrarily nested?

Options:

A.

myArray. reduce ((prev, curr) = > prev.concat(curr) [ ]);

B.

myArray. join ( " , " ).split ( " , " );

C.

[ ] .concat {. . .myArray) ;

D.

myArray.flat(Infinity);

Buy Now
Questions 5

A developer wants to leverage a module to print a price in pretty format, and has imported a method as shown below:

Import printPrice from ‘/path/PricePrettyPrint.js’;

Based on the code, what mustbe true about the printPrice function of the PricePrettyPrint module for this import to work ?

Options:

A.

printPrice must be be a named export

B.

printPrice must be an all export

C.

printPrice must be the default export

D.

printPrice must be a multi exportc

Buy Now
Questions 6

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?

Options:

A.

Class ClothingItem implements Item{

B.

Class ClothingItem {

C.

Class ClothingItem super Item {

D.

Class ClothingItem extends Item {

Buy Now
Questions 7

A developer at Universal Containers is creating their new landing pagebased on HTML, CSS, and JavaScript. The website includes multiple external resources that are loaded when the page is opened.

To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed when the webpage isloaded and there is no need to wait for the resources to be available.

Which statement should be used to call personalizeWebsiteContent based on the above business requirement?

Options:

A.

windows,addEventListener( ' load ' , personalizeWebsiteContent);

B.

windows,addEventListener( ' DOMContent Loaded ' , personalizeWebsiteContent);

C.

windows,addEventListener( ' onload ' , personalizeWebsiteContent);

D.

windows,addEventListener( ' onDOMCContentLoaded ' , personalizeWebsiteContent);

Buy Now
Questions 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.

constretrieveFromLocalStorage = (storageKey) = > {return window.localStorage[storageKey];}

Buy Now
Questions 9

Refer of the string below:

Const str = ‘sa;esforce’=;

Which two statement result in the word ' Sale ' ?

Choose 2 answers

Options:

A.

str, substring(0,5) ;

B.

str, substr(0,5) ;

C.

str, substring(1,5) ;

D.

str, substr(1,5) ;

Buy Now
Questions 10

Teams at Universal Containers (UC) work on multiple JavaScript projects at the same time.

UC is thinking about reusability and how each team can benefit from the work of others.

Going open-source or public is not an option at this time.

Which option is available to UC with npm?

Options:

A.

Private packages can be scored, andscopes can be associated to a privateregistries.

B.

Private registries are not supported by npm, but packages can be installed via URL.

C.

Private packages are not supported, but they can use another package manager likeyarn.

D.

Private registries are not supported by npm, but packages can be installed via git.

Buy Now
Questions 11

A developer at Universal Containers is creating their new landing page based on HTML, CSS, and JavaScript.

To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed when the webpage is fully loaded (HTML content and all related files), in order to do some custom initializations.

Which implementation should be used to call Fe:s:-a;::eHec5;te::.-.ter.: based on the business requirement above?

Options:

A.

Add a listener to thewindow object to handle the DOMContentLoaded event

B.

Add a handler to the personalizeWebsiteContent script to handle the load event

C.

Add a listener to the window object to handle the lead event

D.

Add a handler to the personalizeWebsiteContent script tohandle the DOMContentLoaded event

Buy Now
Questions 12

A developer has the following array of student test grades:

Let arr = [ 7, 8, 5, 8, 9 ];

The Teacher wants to double each score and then see an array of the students

who scored more than 15 points.

How should thedeveloper implement the request?

Options:

A.

Let arr1 = arr.filter(( val) = > ( return val > 15 )) .map (( num) = > ( return num *2 ))

B.

Let arr1 = arr.mapBy (( num) = > ( return num *2 )) .filterBy (( val ) = > return val > 15 )) ;

C.

Let arr1 = arr.map((num) = > num*2). Filter (( val) = > val > 15);

D.

Let arr1 = arr.map((num) = > ( num *2)).filterBy((val) = > ( val > 15 ));

Buy Now
Questions 13

A developer creates a simple webpage with an input field. When a user enters text in

the inputfield and clicks the button, the actual value of the field must be displayed in the

console.

Here is the HTML file content:

< input type =” text” value=”Hello” name =”input” >

< button type =”button” > Display < /button >

The developer wrote the javascript codebelow:

Const button = document.querySelector(‘button’);

button.addEvenListener(‘click’, () = > (

Const input = document.querySelector(‘input’);

console.log(input.getAttribute(‘value’));

When the user clicks the button, the output is always “Hello”.

What needs to be done make this code work as expected?

Options:

A.

Replace line 04 with console.log(input .value);

B.

Replace line 03 with const input = document.getElementByName(‘input’);

C.

Replace line 02 with button.addEventListener(“onclick”, function() {

D.

Replace line 02 with button.addCallback(“click”, function() {

Buy Now
Questions 14

A developer is creating a simple webpage with a button. When a userclicks this button

for the first time, a message is displayed.

The developer wrote the JavaScript code below, but something is missing. The

message gets displayed every time a user clicks the button, instead of just the first time.

01 functionlisten(event) {

02 alert ( ‘Hey! I am John Doe’) ;

03 button.addEventListener (‘click’, listen);

Which two code lines make this code work as required?

Choose 2 answers

Options:

A.

On line 02, use event.first to test if it is the first execution.

B.

On line 04, useevent.stopPropagation ( ),

C.

On line 04, use button.removeEventListener(‘ click” , listen);

D.

On line 06, add an option called once to button.addEventListener().

Buy Now
Questions 15

Refer to the codebelow:

function foo () {

const a =2;

function bat() {

console.log(a);

}

return bar;

}

Why does the function bar have access to variable a ?

Options:

A.

Inner function’s scope

B.

Hoisting

C.

Outer function’s scope

D.

Prototype chain

Buy Now
Questions 16

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:

Options:

A.

If there is an existing setTimeout and the search string change, allow the existingsetTimeout to finish, and do not enqueue a new setTimeout.

B.

When thesearch string changes, enqueue the request within a setTimeout.

C.

Ensure that the network request has the property debounce set to true.

D.

If there is an existing setTimeout and the search string changes, cancel the existingsetTimeout using thepersisted timerId and replace it with a new setTimeout.

E.

Store the timeId of the setTimeout last enqueued by the search string change handle.

Buy Now
Questions 17

Refer to the code below:

Let foodMenu1 = [‘pizza’, ‘burger’, ‘French fries’];

Let finalMenu = foodMenu1;

finalMenu.push(‘Garlic bread’);

What is the value of foodMenu1 after the code executes?

Options:

A.

[ ‘pizza’,’Burger’, ‘French fires’, ‘Garlic bread’]

B.

[ ‘pizza’,’Burger’, ‘French fires’]

C.

[ ‘Garlic bread’ , ‘pizza’,’Burger’, ‘French fires’ ]

D.

[ ‘Garlicbread’]

Buy Now
Questions 18

Refer to the following array:

Let arr = [1, 2, 3, 4, 5];

Which three options result in x evaluating as [1,2]?

Choose 3 answer

Options:

A.

let x = arr. slice (2);

B.

let x = arr. slice (0, 2);

C.

let x arr.filter((a) = > (return a < = 2 });

D.

let x = arr.filter ((a) = > 2 }) ;

E.

let x =arr.splice(0, 2);

Buy Now
Questions 19

Refer to the following code:

01 function Tiger(){

02this.Type = ‘Cat’;

03 this.size = ‘large’;

04 }

05

06 let tony = new Tiger();

07 tony.roar = () = > {

08 console.log(‘They\’re great1’);

09 };

10

11 function Lion(){

12 this.type = ‘Cat’;

13 this.size = ‘large’;

14 }

15

16 let leo = new Lion();

17 //Insertcode here

18 leo.roar();

Which two statements could be inserted at line 17 to enable the function call on line 18?

Choose 2 answers.

Options:

A.

Leo.roar = () = > { console.log(‘They\’re pretty good:’); };

B.

Object.assign(leo,Tiger);

C.

Object.assign(leo,tony);

D.

Leo.prototype.roar = () = > { console.log(‘They\’re pretty good:’); };

Buy Now
Questions 20

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.

JavaScript-Developer-I Question 20

Which two results occur when running this test on the updated sum3 function?

Choose 2 answers

Options:

A.

The line 05 assertion passes.

B.

The line 02 assertion passes.

C.

The line 02 assertion fails.

D.

The line 05 assertion fails.

Buy Now
Questions 21

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]

Buy Now
Questions 22

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 areused to address this ?

Choose 2 answers

Options:

A.

Use the document object instead of the window object.

B.

Assign variables to the global object.

C.

Create a new window object in the root file.

D.

Assign variables to module.exports and require them as needed.

Buy Now
Questions 23

Refer to the following code block:

JavaScript-Developer-I Question 23

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.

Buy Now
Questions 24

Refer to the following code block:

class Animal{

constructor(name){

this.name = name;

}

makeSound(){

console.log(`${this.name} ismaking a sound.`)

}

}

class Dog extends Animal{

constructor(name){

super(name)

this.name = name;

}

makeSound(){

console.log(`${this.name} is barking.`)

}

}

let myDog = new Dog( ' Puppy ' );

myDog.makeSound();

What is the console output?

Options:

A.

Puppy is barking

Buy Now
Questions 25

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 teamhas 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 stabilitywith 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 requesthandling .

Buy Now
Questions 26

Refer to the code below:

JavaScript-Developer-I Question 26

Considering that JavaScript is single-threaded, what is the output of line 08 after the code executes?

Options:

A.

10

B.

11

C.

12

D.

13

Buy Now
Questions 27

A developer initiates a server with the file server,js and adds dependencies in the source codes package,json that are required to run the server.

Which command should the developer run to start the server locally?

Options:

A.

start server,js

B.

npm start server,js

C.

npm start

D.

node start

Buy Now
Questions 28

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 needsthe folder location that the code executes from.

Which global variable can be used in the script?

Options:

A.

window.location

B.

_filename

C.

_dirname

D.

this.path

Buy Now
Questions 29

Which statement parses successfully?

Options:

A.

JSON. parse ( " " foo " ' );

B.

JSON.parse ( " " foo ' " );

C.

JSON.parse ( " foo " );

D.

JSON.parse ( " foo " );

Buy Now
Questions 30

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

Buy Now
Questions 31

Which code statement below correctly persists an objects inlocal 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);}

Buy Now
Questions 32

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)

JavaScript-Developer-I Question 32

B)

JavaScript-Developer-I Question 32

C)

JavaScript-Developer-I Question 32

D)

JavaScript-Developer-I Question 32

Options:

A.

Option

B.

Option

C.

Option

D.

Option

Buy Now
Questions 33

Given the code below:

const delay = sync delay = > {

Return new Promise((resolve, reject) = > {

setTimeout (resolve,delay);});};

const callDelay =async () = > {

const yup =await delay(1000);

console.log(1);

What is logged to the console?

Options:

A.

1 2 3

B.

1 3 2

C.

2 1 3

D.

2 3 1

Buy Now
Questions 34

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?

Options:

A.

A navigate event is fired with a state property that details the previous application state.

B.

The page isnavigated away from and the previous page in the browser’s history is loaded.

C.

The page reloads and all Javascript is reinitialized.

D.

A popstate event is fired with a state property that details the application’s last state.

Buy Now
Questions 35

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?

Options:

A.

Event.clicked

B.

e.nodeTarget ==this

C.

event.target.nodeName == ‘BUTTON’

D.

button.addEventListener(‘click’)

Buy Now
Questions 36

Refer to the code below:

Function Person(firstName, lastName, eyecolor) {

this.firstName =firstName;

this.lastName = lastName;

this.eyeColor = eyeColor;

}

Person.job = ‘Developer’;

const myFather = new Person(‘John’, ‘Doe’);

console.log(myFather.job);

What is the output after the code executes?

Options:

A.

ReferenceError: eyeColor is not defined

B.

ReferenceError: assignment to undeclared variable “Person”

C.

Developer

D.

Undefined

Buy Now
Questions 37

Consider type coercion, what does the following expression evaluate to?

True + 3 + ‘100’ + null

Options:

A.

104

B.

4100

C.

‘3100null’

D.

‘4100null’

Buy Now
Questions 38

A developer creates a simple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must be displayedin the console.

Here is the HTML file content:

< input type =” text” value=”Hello” name =”input” >

< button type =”button” > Display < /button > The developer wrote the javascript code below:

Const button = document.querySelector(‘button’);

button.addEvenListener(‘click’, () = > (

Const input = document.querySelector(‘input’);

console.log(input.getAttribute(‘value’));

When the user clicks the button, the output is always “Hello”.

What needs to be done to make this code work as expected?

Options:

A.

Replace line 04 with console.log(input .value);

B.

Replace line 03 with const input = document.getElementByName(‘input’);

C.

Replace line 02 with button.addCallback(“click”, function() {

D.

Replace line 02 with button.addEventListener(“onclick”, function() {

Buy Now
Questions 39

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 resultof executing line 04?

Options:

A.

0

B.

6

C.

-Infinity

D.

RuntimeError

Buy Now
Questions 40

Refer to the code below:

< html lang=”en” >

< table onclick=”console.log(Table log’);” >

< tr id=”row1” >

< td > Click me! < /td >

< /tr >

< table >

< script >

functionprintMessage(event) {

console.log(‘Row log’);

}

Let elem = document.getElementById(‘row1’);

elem.addEventListener(‘click’, printMessage, false);

< /script >

< /html >

Which code change should be made for the console to log only Row log when ‘Click me! ’ is

clicked?

Options:

A.

Add.event.stopPropagation(); to window.onLoad event handler.

B.

Add event.stopPropagation(); to printMessage function.

C.

Add event.removeEventListener(); to window.onLoad event handler.

D.

Add event.removeEventListener(); toprintMessage function.

Buy Now
Questions 41

Which statement accurately describes the behaviour of the async/ await keyworks ?

Options:

A.

The associated class contains some asynchronous functions.

B.

The associated function will always return a promise

C.

Theassociated function can only be called via asynchronous methods

D.

The associated sometimes returns a promise.

Buy Now
Questions 42

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?

Options:

A.

10 -10

B.

5 -5

C.

5 - 10

D.

10 - 5

Buy Now
Questions 43

Given the following code:

JavaScript-Developer-I Question 43

is the output of line 02?

Options:

A.

' ' x ' '

B.

' ' null ' ' '

C.

' ' object ' '

D.

' ' undefined ' '

Buy Now
Questions 44

A developer wrote a fizzbuzz function thatwhen passed in a number, returns the

following:

● ‘Fizz’ if the number is divisible by 3.

● ‘Buzz’ if the number is divisible by 5.

● ‘Fizzbuzz’ if the number is divisible by both 3 and 5.

● Empty string if the number is divisible by neither 3 or 5.

Whichtwo test cases will properly test scenarios for the fizzbuzz function?

Choose 2 answers

Options:

A.

let res = fizzbuzz(5);console.assert ( res === ‘ ’ );

B.

let res = fizzbuzz(15);console.assert ( res === ‘ fizzbuzz ’ )

C.

let res = fizzbuzz(Infinity);console.assert ( res === ‘ ’ )

D.

let res = fizzbuzz(3);console.assert ( res === ‘ buzz ’ )

Buy Now
Questions 45

Refer to the code below:

JavaScript-Developer-I Question 45

What is the output of this function when called with an empty array?

Options:

A.

Return 0

B.

Return 5

C.

Return NaN

D.

Return Infinity

Buy Now
Questions 46

Refer to the code below:

JavaScript-Developer-I Question 46

Which value can a developer expect when referencing country,capital,cityString?

Options:

A.

' London '

B.

undefined

C.

An error

D.

' NaN '

Buy Now
Questions 47

Given the code below:

Which three code segments result in a correct conversion from number to string? Choose 3 answers

Options:

A.

let strValue = numValue. toString();

B.

let strValue = * * 4 numValue;

C.

let strValue = numValue.toText ();

D.

let scrValue = String(numValue);

E.

let strValue = (String)numValue;

Buy Now
Questions 48

Considering type coercion, what does the following expression evaluate to?

True + ‘13’ + NaN

Options:

A.

‘ 113Nan ’

B.

14

C.

‘ true13 ’

D.

‘ true13NaN ’

Buy Now
Questions 49

Refer to the code below:

01 const exec = (item, delay) = > {

02 newPromise(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

Options:

A.

Async runParallel () .then(data);

B.

runParallel ( ). done(function(data){return data;});

C.

runParallel () .then(data);

D.

runParallel () .then(function(data)return data

Buy Now
Questions 50

Refer the following code

JavaScript-Developer-I Question 50

what is the value of array after code executes?

Options:

Buy Now
Questions 51

Refer to the code below:

Const myFunction = arr = > {

Return arr.reduce((result, current) = > {

Return result = current;

}, 10};

}

What is the output of this function when called with an empty array ?

Options:

A.

Returns 0

B.

Throws an error

C.

Returns 10

D.

Returns NaN

Buy Now
Questions 52

Refer to code below:

Let first = ‘who’;

Let second = ‘what’;

Try{

Try{

Throw new error(‘Sad trombone’);

}catch (err){

First =’Why’;

}finally {

Second =’when’;

} catch (err) {

Second =’Where’;

}

What are the values for first and second once the code executes ?

Options:

A.

First is Who and second is When

B.

First is why and second is where

C.

First is who and second is where

D.

First is why and second is when

Buy Now
Questions 53

Refer to the code:

JavaScript-Developer-I Question 53

Given the code above, which three properties are set for pet1? Choose 3 answers

Options:

A.

name

B.

owner

C.

type

D.

canTalk

E.

size

Buy Now
Questions 54

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();

Whatis the value of result after the code executes?

Options:

A.

100

B.

undefined

C.

null

D.

70

Buy Now
Questions 55

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) {

Buy Now
Questions 56

Given the following code:

let x = null;

console.log(typeof x);

What is the output?

Options:

A.

" object "

B.

" undefined "

C.

" null "

D.

" x "

Buy Now
Questions 57

Refer to the code below:

JavaScript-Developer-I Question 57

Which replacement for the conditionalstatement on line 02 allows a developer to correctly determine

that a specific element, myElement on the page had been clicked?

Options:

A.

event.target.id == ' myElement '

Buy Now
Questions 58

At Universal Containers, every team has its own way of copyingJavaScript objects. The code snippet shows an Implementation from one team:

JavaScript-Developer-I Question 58

What is the output of the code execution?

Options:

A.

Hello John Doe

B.

Hello Dan

C.

Hello Dan Doe

D.

SyntaxError: Unexpected token in JSON

Buy Now
Questions 59

A developer copied a JavaScript object:

JavaScript-Developer-I Question 59

How does the developer access dan ' s forstName,lastName? Choose 2 answers

Options:

A.

dan,name

B.

dan,firstname ( ) + dan, lastName ( )

C.

dan, firstName =dan.lastName

D.

dan,name ( )

Buy Now
Questions 60

Given the followingcode, what is the value of x?

let x = ‘15 ' + (10 * 2);

Options:

A.

35

B.

50

C.

1520

D.

3020

Buy Now
Questions 61

Refer to code below:

Let productSKU = ‘8675309’ ;

A developer has a requirement to generate SKU numbers that are always 19 characters lon,

starting with ‘sku’, and padded with zeros.

Which statement assigns the values sku0000000008675309 ?

Options:

A.

productSKU = productSKU .padStart (19. ‘0’).padstart(‘sku’);

B.

productSKU = productSKU .padEnd (16. ‘0’).padstart(‘sku’);

C.

productSKU = productSKU .padEnd (16. ‘0’).padstart(19, ‘sku’);

D.

productSKU = productSKU .padStart (16. ‘0’).padstart(19, ‘sku’);

Buy Now
Questions 62

A class was written to represent items for purchase in an online store, and a secondclass

Representing items that are on sale at a discounted price. THe constructor sets the name to the

first value passed in. The pseudocode is below:

Class Item {

constructor(name, price) {

… // Constructor Implementation

}

}

Class SaleItem extends Item {

constructor (name, price, discount) {

...//Constructor Implementation

}

}

There is a new requirement for a developer to implement a description method that will return a

brief description for Item and SaleItem.

Let regItem =new Item(‘Scarf’, 55);

Let saleItem = new SaleItem(‘Shirt’ 80, -1);

Item.prototype.description = function () { return ‘This is a ’ + this.name;

console.log(regItem.description());

console.log(saleItem.description());

SaleItem.prototype.description = function () { return ‘This is a discounted ’ +

this.name; }

console.log(regItem.description());

console.log(saleItem.description());

What is the output when executing the code above ?

Options:

A.

This is a ScarfUncaught TypeError: saleItem.description is not a functionThis is aScarfThis is a discounted Shirt

B.

This is a ScarfThis is a ShirtThis is a ScarfThis is a discounted Shirt

C.

This is a ScarfThis is a ShirtThis is a discounted ScarfThis is a discounted Shirt

D.

This is aScarfUncaught TypeError: saleItem.description is not a functionThis is a ShirtThis is a did counted Shirt

Buy Now
Questions 63

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

Options:

A.

‘Update’ , (recordId : ‘123abc’(

B.

‘Update’ , ‘123abc’

C.

{ type : ‘update’, recordId : ‘123abc’ }

D.

‘Update’ , {Details : {recordId : ‘123abc’}}

Buy Now
Questions 64

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?

Options:

A.

Promise.reject(‘cool errorhere’).then(error = > console.error(error));

B.

Promise.reject(‘cool error here’).catch(error = > console.error(error));

C.

New Promise((resolve, reject) = > (throw ‘cool error here’}).catch(error = > console.error(error)) ;

D.

New Promise(() = > (throw ‘cool error here’}).then(null, error = > console.error(error)));

Buy Now
Questions 65

A developer wants to use a module called DataPrettyPrint. This module exports one default functioncalled printDate ().

How can a developer import and use the printDate() function?

A)

JavaScript-Developer-I Question 65

B)

JavaScript-Developer-I Question 65

C)

JavaScript-Developer-I Question 65

D)

JavaScript-Developer-I Question 65

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Exam Name: Salesforce Certified JavaScript Developer JS-Dev-101
Last Update: May 16, 2026
Questions: 217

PDF + Testing Engine

$63.52  $181.49

Testing Engine

$50.57  $144.49
buy now JavaScript-Developer-I testing engine

PDF (Q&A)

$43.57  $124.49
buy now JavaScript-Developer-I pdf