ExamGecko
Home Home / Salesforce / Certified JavaScript Developer I

Salesforce Certified JavaScript Developer I Practice Test - Questions Answers, Page 14

Question list
Search
Search

List of questions

Search

Related questions











Refer to the code below:

Refer to the code below:

Const resolveAfterMilliseconds = (ms) => Promise.resolve (

setTimeout (( => console.log(ms), ms ));

Const aPromise = await resolveAfterMilliseconds(500);

Const bPromise = await resolveAfterMilliseconds(500);

Await aPromise, wait bPromise;

What is the result of running line 05?

A.
aPromise and bPromise run sequentially.
A.
aPromise and bPromise run sequentially.
Answers
B.
Neither aPromise or bPromise runs.
B.
Neither aPromise or bPromise runs.
Answers
C.
aPromise and bPromise run in parallel.
C.
aPromise and bPromise run in parallel.
Answers
D.
Only aPromise runs.
D.
Only aPromise runs.
Answers
Suggested answer: B

Refer to the code below:

Const searchTest = 'Yay! Salesforce is amazing!" ;

Let result1 = searchText.search(/sales/i);

Let result 21 = searchText.search(/sales/i);

console.log(result1);

console.log(result2);

After running this code, which result is displayed on the console?

A.
> true > false
A.
> true > false
Answers
B.
> 5 >undefined
B.
> 5 >undefined
Answers
C.
> 5 > -1
C.
> 5 > -1
Answers
D.
> 5 > 0
D.
> 5 > 0
Answers
Suggested answer: B

Why would a developer specify a package.jason as a developed forge instead of a dependency ?

A.
It is required by the application in production.
A.
It is required by the application in production.
Answers
B.
It is only needed for local development and testing.
B.
It is only needed for local development and testing.
Answers
C.
Other required packages depend on it for development.
C.
Other required packages depend on it for development.
Answers
D.
It should be bundled when the package is published.
D.
It should be bundled when the package is published.
Answers
Suggested answer: B

Refer to the code below:

let o = {

get js() {

let city1 = String("st. Louis");

let city2 = String(" New York");

return {

firstCity: city1.toLowerCase(),

secondCity: city2.toLowerCase(),

What value can a developer expect when referencing o.js.secondCity?

A.
Undefined
A.
Undefined
Answers
B.
' new york '
B.
' new york '
Answers
C.
' New York '
C.
' New York '
Answers
D.
An error
D.
An error
Answers
Suggested answer: B

Given the code below:

Setcurrent URL ();

console.log('The current URL is: ' +url );

function setCurrentUrl() {

Url = window.location.href:

What happens when the code executes?

What happens when the code executes?

A.
The url variable has local scope and line 02 throws an error.
A.
The url variable has local scope and line 02 throws an error.
Answers
B.
The url variable has global scope and line 02 executes correctly.
B.
The url variable has global scope and line 02 executes correctly.
Answers
C.
The url variable has global scope and line 02 throws an error.
C.
The url variable has global scope and line 02 throws an error.
Answers
D.
The url variable has local scope and line 02 executes correctly.
D.
The url variable has local scope and line 02 executes correctly.
Answers
Suggested answer: B

A developer has two ways to write a function:

Option A:

function Monster() {

This.growl = () => {

Console.log ("Grr!");

}}

Option B:

function Monster() {};

Monster.prototype.growl =() => {

console.log("Grr!");

}

After deciding on an option, the developer creates 1000 monster objects.

How many growl methods are created with Option A Option B?

A.
1 growl method is created for Option A. 1000 growl methods are created for Option B.
A.
1 growl method is created for Option A. 1000 growl methods are created for Option B.
Answers
B.
1000 growl method is created for Option A. 1 growl methods are created for Option B.
B.
1000 growl method is created for Option A. 1 growl methods are created for Option B.
Answers
C.
1000 growl methods are created regardless of which option is used.
C.
1000 growl methods are created regardless of which option is used.
Answers
D.
1 growl method is created regardless of which option is used.
D.
1 growl method is created regardless of which option is used.
Answers
Suggested answer: B

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

Choose 3 answers

A.
IIFEs
A.
IIFEs
Answers
B.
indexedDB
B.
indexedDB
Answers
C.
Global variables
C.
Global variables
Answers
D.
Cookies
D.
Cookies
Answers
E.
localStorage.
E.
localStorage.
Answers
Suggested answer: A, B, E

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 ?

A.
Returns 0
A.
Returns 0
Answers
B.
Throws an error
B.
Throws an error
Answers
C.
Returns 10
C.
Returns 10
Answers
D.
Returns NaN
D.
Returns NaN
Answers
Suggested answer: D

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

Choose 2 answers

A.
Use the document object instead of the window object.
A.
Use the document object instead of the window object.
Answers
B.
Assign variables to the global object.
B.
Assign variables to the global object.
Answers
C.
Create a new window object in the root file.
C.
Create a new window object in the root file.
Answers
D.
Assign variables to module.exports and require them as needed.
D.
Assign variables to module.exports and require them as needed.
Answers
Suggested answer: B

Refer to the following array:

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

Which three options result in x evaluating as [3, 4, 5] ?

Choose 3 answers.

A.
Let x= arr.filter (( a) => (a<2));
A.
Let x= arr.filter (( a) => (a<2));
Answers
B.
Let x= arr.splice(2,3);
B.
Let x= arr.splice(2,3);
Answers
C.
Let x= arr.slice(2);
C.
Let x= arr.slice(2);
Answers
D.
Let x= arr.filter((a) => ( return a>2 ));
D.
Let x= arr.filter((a) => ( return a>2 ));
Answers
E.
Let x = arr.slice(2,3);
E.
Let x = arr.slice(2,3);
Answers
Suggested answer: B, C, D
Total 224 questions
Go to page: of 23