Pre-Summer Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: validbest

Pass the Salesforce Developer JavaScript-Developer-I Questions and answers with ValidTests

Exam JavaScript-Developer-I All Questions
Exam JavaScript-Developer-I Premium Access

View all detail and faqs for the JavaScript-Developer-I exam

Viewing page 3 out of 5 pages
Viewing questions 21-30 out of questions
Questions # 21:

UniversalContainers 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 insidethe DOM, like the

one in the code below:

Question # 21

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 eventto 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 scriptthat prevents the load event to be fired.

Expert Solution
Questions # 22:

A developer wants to use a module named universalContainersLib and then call functions from it.

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

Options:

A.

import * from '/path/universalContainersLib.js';universalContainersLib. foo ()7universalContainersLib.bar ();

B.

import {foo,bar} from '/path/universalCcontainersLib.js';foo():bar()?

C.

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

D.

import * as lib from '/path/universalContainersLib.js';lib.foo();lib. bar ();

Expert Solution
Questions # 23:

Whichstatement accurately describes an aspect of promises?

Options:

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.

Expert Solution
Questions # 24:

Refer to code below:

Let a =’a’;

Let b;

// b = a;

console.log(b);

What is displayed when the code executes?

Options:

A.

ReferenceError: b is not defined

B.

A

C.

Undefined

D.

Null

Expert Solution
Questions # 25:

Given the code below:

01 function GameConsole (name) {

02 this.name = name;

03 }

04

05GameConsole.prototype.load = function(gamename) {

06 console.log( ` $(this.name) is loading agame : $(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 cartridgegame: 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) {

Expert Solution
Questions # 26:

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

Expert Solution
Questions # 27:

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

True + 3 + ‘100’ + null

Options:

A.

104

B.

4100

C.

‘3100null’

D.

‘4100null’

Expert Solution
Questions # 28:

A developer creates a genericfunction to log custom messages 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?

Options:

A.

Assert

B.

Log

C.

Message

D.

Info

E.

Error

Expert Solution
Questions # 29:

Which statement parses successfully?

Options:

A.

JSON. parse (""foo"');

B.

JSON.parse (""foo'");

C.

JSON.parse ("foo");

D.

JSON.parse ("foo");

Expert Solution
Questions # 30:

Refer to the HTML below:

  • Leo
  • Tony
  • Tiger

Which JavaScript statement results in changing “ Tony” to “Mr. T.”?

Options:

A.

document.querySelectorAll(‘$main $TONY’).innerHTML = ’ Mr. T. ’;

B.

document.querySelector(‘$mainli:second-child’).innerHTML = ’ Mr. T. ’;

C.

document.querySelector(‘$main li.Tony’).innerHTML = ’ Mr. T. ’;

D.

document.querySelector(‘$main li:nth-child(2)’),innerHTML =’ Mr. T. ’;

Expert Solution
Viewing page 3 out of 5 pages
Viewing questions 21-30 out of questions