Leads4pass > Salesforce > Salesforce Certifications > JAVASCRIPT-DEVELOPER-I > JAVASCRIPT-DEVELOPER-I Online Practice Questions and Answers

JAVASCRIPT-DEVELOPER-I Online Practice Questions and Answers

Questions 4

A developer needs to test this function:

01const sum3 = (arr) => (

02if (!arr.length) return 0,

03if (arr.length === 1) return arr[0],

04if (arr.length === 2) return arr[0]+ arr[1],

05 return arr[0] + arr[1] + arr[2],

06 );

Which two assert statements are valid tests for the function?

Choose 2 answers

A. console.assert(sum3(1, `2')) == 12);

B. console.assert(sum3(0)) == 0);

C. console.assert(sum3(-3, 2 )) == -1);

D. console.assert(sum3(`hello', 2, 3, 4)) === NaN);

Buy Now
Questions 5

Given the following code:

Let x =null;

console.log(typeof x);

What is the output of the line 02?

A. "Null"

B. "X"

C. "Object"

D. "undefined"

Buy Now
Questions 6

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

correctlydetermine that a button on page is clicked?

A. Event.clicked

B. e.nodeTarget ==this

C. event.target.nodeName == `BUTTON'

D. button.addEventListener(`click')

Buy Now
Questions 7

A developer creates a generic function to log custommessages in the console. To do this, the function below is implemented.

01 function logStatus(status){

02 console./*Answer goes here*/{`Item status is: %s', status};

03 }

Which three console logging methods allow the use of string substitution in line 02?

A. Assert

B. Log

C. Message

D. Info

E. Error

Buy Now
Questions 8

Developer wants to use a module named universalContainersLiband them call functions from it.

How should a developer import every function from the module and then call the functions foo and bar ?

A. import * ad lib from `/path/universalContainersLib.js'; lib.foo(); lib.bar();

B. import (foo, bar) from `/path/universalContainersLib.js'; foo(); bar();

C. import all from `/path/universalContaineraLib.js'; universalContainersLib.foo(); universalContainersLib.bar();

D. import * from `/path/universalContaineraLib.js'; universalContainersLib.foo(); universalContainersLib.bar();

Buy Now
Questions 9

Which three statements are true about promises ? Choose 3 answers

A. The executor of a new Promise runs automatically.

B. A Promise has a .then() method.

C. A fulfilled or rejected promise will not change states .

D. A settled promise can become resolved.

E. A pending promise can become fulfilled, settled, or rejected.

Buy Now
Questions 10

Refer to the code below:

01 const server = require(`server');

02 /* Insert code here */

A developer imports a library that creates a web server.The imported library uses events and callbacks to start the servers

Which code should be inserted at the line 03 to set up an event and start the web server ?

A. Server.start ();

B. server.on(` connect ' , ( port) => { console.log(`Listening on ' , port);})

C. server()

D. serve(( port) => (

E. console.log( `Listening on ', port) ;

Buy Now
Questions 11

Which statement accurately describes an aspect of promises?

A. Arguments for the callback function passed to .then() are optional.

B. In a.then()function, returning results is not necessary since callbacks will catch the result of a previous promise.

C. .then() cannot be added after a catch.

D. .then() manipulates and returns the original promise.

Buy Now
Questions 12

Which three browser specific APIs are available for developers to persist data between page loads? Choose 3 answers

A. IIFEs

B. indexedDB

C. Global variables

D. Cookies

E. localStorage.

Buy Now
Questions 13

Refer to following code:

class Vehicle {

constructor(plate) {

This.plate =plate;

}

}

Class Truck extends Vehicle {

constructor(plate, weight) {

//Missing code

This.weight = weight;

}

displayWeight() {

console.log(`The truck ${this.plate} has a weight of ${this.weight}lb.');}}

Let myTruck = new Truck(`123AB', 5000);

myTruck.displayWeight();

Which statement should be added to line 09 for the code to display `The truck 123AB has a weight of 5000lb.'?

A. Super.plate =plate;

B. super(plate);

C. This.plate =plate;

D. Vehicle.plate = plate;

Buy Now
Exam Name: Salesforce Certified JavaScript Developer I
Last Update: Feb 12, 2025
Questions: 223
10%OFF Coupon Code: SAVE10

PDF (Q&A)

$49.99

VCE

$55.99

PDF + VCE

$65.99