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

Viewing page 1 out of 7 pages
Viewing questions 1-10 out of questions
Questions # 1:

What is the result of the code block?

Options:

A.

The console logs only ‘flag’.


B.

The console logs ‘flag’ and another flag.


C.

An error is thrown.


D.

The console logs ‘flag’ and then an error is thrown.


Expert Solution
Questions # 2:

A developer wrote the following code:

01 let X = object.value;

02

03 try {

04 handleObjectValue(X);

05 } catch (error) {

06 handleError(error);

07 }

Thedeveloper has a getNextValue function to execute after handleObjectValue(), but

does not want to execute getNextValue() if an error occurs.

How can the developer change the code to ensure this behavior?

Options:

A.

03 try{04 handleObjectValue(x);05 }catch(error){06 handleError(error);07 } then {08 getNextValue();09 }


B.

03 try{04 handleObjectValue(x);05 } catch(error){06 handleError(error);07 } finally {08 getNextValue();10 }


C.

03 try{04 handleObjectValue(x);05 } catch(error){06 handleError(error);07 }08 getNextValue();


D.

03 try {04 handleObjectValue(x)05 ……………………


Expert Solution
Questions # 3:

Which three statements are true about promises ?

Choose 3 answers

Options:

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 canbecome fulfilled, settled, or rejected.


Expert Solution
Questions # 4:

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)

Question # 4

B)

Question # 4

C)

Question # 4

D)

Question # 4

Options:

A.

Option A


B.

Option B


C.

Option C


D.

Option D


Expert Solution
Questions # 5:

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

one in the code below:

Question # 5

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 # 6:

Refer to the code below?

Let searchString = ‘ look for this ’;

Which two options remove the whitespace from the beginning of searchString?

Choose 2 answers

Options:

A.

searchString.trimEnd();


B.

searchString.trimStart();


C.

trimStart(searchString);


D.

searchString.replace(/*\s\s*/, ‘’);


Expert Solution
Questions # 7:

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


Expert Solution
Questions # 8:

Given the code below:

Question # 8

What is logged to the console'

Options:

A.

1 2 3 4 5


B.

1 2 5 3 4


C.

2 5 1 3 4


D.

2 5 3 4 1


Expert Solution
Questions # 9:

Refer to the code below:

Async funct on functionUnderTest(isOK) {

If (isOK) return ‘OK’;

Throw new Error(‘not OK’);

)

Which assertion accurately tests the above code?

Options:

A.

Console.assert (await functionUnderTest(true), ‘ OK ’)


B.

Console.assert (await functionUnderTest(true), ‘ not OK ’)


C.

Console.assert (await functionUnderTest(true), ‘ notOK ’)


D.

Console.assert (await functionUnderTest(true), ‘OK’)


Expert Solution
Questions # 10:

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

Question # 10

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

Question # 10

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


Expert Solution
Viewing page 1 out of 7 pages
Viewing questions 1-10 out of questions