ExamGecko
Home Home / Salesforce / Certified JavaScript Developer I

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

Question list
Search
Search

List of questions

Search

Related questions











Refer to code below:

Const objBook = {

Title: 'Javascript',

}; Object.preventExtensions(objBook);

Const newObjBook = objBook;

newObjectBook.author = 'Robert';

What are the values of objBook and newObjBook respectively ?

A.
[title: "javaScript"] [title: "javaScript"]
A.
[title: "javaScript"] [title: "javaScript"]
Answers
B.
{author: "Robert", title: "javaScript}Undefined
B.
{author: "Robert", title: "javaScript}Undefined
Answers
C.
{author: "Robert", title: "javaScript}{author: "Robert", title: "javaScript}
C.
{author: "Robert", title: "javaScript}{author: "Robert", title: "javaScript}
Answers
D.
{author: "Robert"}{author: "Robert", title: "javaScript}
D.
{author: "Robert"}{author: "Robert", title: "javaScript}
Answers
Suggested answer: A

Refer to code below:

console.log(0);

setTimeout(() => (

console.log(1);

});

console.log(2);

setTimeout(() => {

console.log(3);

), 0);

console.log(4);

In which sequence will the numbers be logged?

A.
01234
A.
01234
Answers
B.
02431
B.
02431
Answers
C.
02413
C.
02413
Answers
D.
13024
D.
13024
Answers
Suggested answer: B

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?

A.
A navigate event is fired with a state property that details the previous application state.
A.
A navigate event is fired with a state property that details the previous application state.
Answers
B.
The page is navigated away from and the previous page in the browser's history is loaded.
B.
The page is navigated away from and the previous page in the browser's history is loaded.
Answers
C.
The page reloads and all Javascript is reinitialized.
C.
The page reloads and all Javascript is reinitialized.
Answers
D.
A popstate event is fired with a state property that details the application's last state.
D.
A popstate event is fired with a state property that details the application's last state.
Answers
Suggested answer: B

Refer to the expression below:

Let x = ('1' + 2) == (6 * 2);

How should this expression be modified to ensure that evaluates to false?

A.
Let x = ('1' + ' 2') == ( 6 * 2);
A.
Let x = ('1' + ' 2') == ( 6 * 2);
Answers
B.
Let x = ('1' + 2) == ( 6 * 2);
B.
Let x = ('1' + 2) == ( 6 * 2);
Answers
C.
Let x = (1 + 2) == ( '6' / 2);
C.
Let x = (1 + 2) == ( '6' / 2);
Answers
D.
Let x = (1 + 2 ) == ( 6 / 2);
D.
Let x = (1 + 2 ) == ( 6 / 2);
Answers
Suggested answer: B

A developer wants to define a function log to be used a few times on a single-file JavaScript script.

01 // Line 1 replacement

02 console.log('"LOG:', logInput);

03 }

Which two options can correctly replace line 01 and declare the function for use?

Choose 2 answers

A.
function leg(logInput) {
A.
function leg(logInput) {
Answers
B.
const log(loginInput) {
B.
const log(loginInput) {
Answers
C.
const log = (logInput) => {
C.
const log = (logInput) => {
Answers
D.
function log = (logInput) {
D.
function log = (logInput) {
Answers
Suggested answer: A, C

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 foo and bar?

A.
import * from '/path/universalContainersLib.js'; universalContainersLib. foo ()7 universalContainersLib.bar ();
A.
import * from '/path/universalContainersLib.js'; universalContainersLib. foo ()7 universalContainersLib.bar ();
Answers
B.
import {foo,bar} from '/path/universalCcontainersLib.js'; foo(): bar()?
B.
import {foo,bar} from '/path/universalCcontainersLib.js'; foo(): bar()?
Answers
C.
import all from '/path/universalContainersLib.js'; universalContainersLib.foo(); universalContainersLib.bar ();
C.
import all from '/path/universalContainersLib.js'; universalContainersLib.foo(); universalContainersLib.bar ();
Answers
D.
import * as lib from '/path/universalContainersLib.js'; lib.foo(); lib. bar ();
D.
import * as lib from '/path/universalContainersLib.js'; lib.foo(); lib. bar ();
Answers
Suggested answer: D

Which two console logs output NaN?

Choose 2 answers | |

A.
console.log(10 / Number('5) ) ;
A.
console.log(10 / Number('5) ) ;
Answers
B.
console.log(parseInt ' ("two')) ;
B.
console.log(parseInt ' ("two')) ;
Answers
C.
console.log(10 / 0);
C.
console.log(10 / 0);
Answers
D.
console.loeg(10 / 'five');
D.
console.loeg(10 / 'five');
Answers
Suggested answer: A, B

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.
A.
Answers
B.
B.
Answers
C.
C.
Answers
D.
D.
Answers
Suggested answer: A

A developer has a formatName function that takes two arguments, firstName and lastName and returns a string. They want to schedule the function to run once after five seconds.

What is the correct syntax to schedule this function?

A.
setTimeout (formatName(), 5000, "John", "BDoe");
A.
setTimeout (formatName(), 5000, "John", "BDoe");
Answers
B.
setTimeout (formatName('John', ''Doe'), 5000);
B.
setTimeout (formatName('John', ''Doe'), 5000);
Answers
C.
setTimout(() => { formatName("John', 'Doe') }, 5000);
C.
setTimout(() => { formatName("John', 'Doe') }, 5000);
Answers
D.
setTimeout ('formatName', 5000, 'John", "Doe');
D.
setTimeout ('formatName', 5000, 'John", "Doe');
Answers
Suggested answer: D

Which statement parses successfully?

A.
JSON. parse (""foo"');
A.
JSON. parse (""foo"');
Answers
B.
JSON.parse (""foo'");
B.
JSON.parse (""foo'");
Answers
C.
JSON.parse ("foo");
C.
JSON.parse ("foo");
Answers
D.
JSON.parse ("foo");
D.
JSON.parse ("foo");
Answers
Suggested answer: A
Total 224 questions
Go to page: of 23