ExamGecko
Home Home / Salesforce / Certified JavaScript Developer I

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

Question list
Search
Search

List of questions

Search

Related questions











A class was written to represent items for purchase in an online store, and a second class Representing items that are on sale at a discounted price. THe constructor sets the name to the first value passed in. The pseudocode is below:

Class Item { constructor(name, price) { … // Constructor Implementation

}} Class SaleItem extends Item { constructor (name, price, discount) {

A.
.//Constructor Implementation}}There is a new requirement for a developer to implement a description method that will return a brief description for Item and SaleItem.Let regItem =new Item('Scarf', 55);Let saleItem = new SaleItem('Shirt' 80, -1);Item.prototype.description = function () { return 'This is a ' + this.name; console.log(regItem.description()); console.log(saleItem.description()); SaleItem.prototype.description = function () { return 'This is a discounted ' + this.name; } console.log(regItem.description()); console.log(saleItem.description()); What is the output when executing the code above ?
A.
.//Constructor Implementation}}There is a new requirement for a developer to implement a description method that will return a brief description for Item and SaleItem.Let regItem =new Item('Scarf', 55);Let saleItem = new SaleItem('Shirt' 80, -1);Item.prototype.description = function () { return 'This is a ' + this.name; console.log(regItem.description()); console.log(saleItem.description()); SaleItem.prototype.description = function () { return 'This is a discounted ' + this.name; } console.log(regItem.description()); console.log(saleItem.description()); What is the output when executing the code above ?
Answers
B.
This is a ScarfUncaught TypeError: saleItem.description is not a functionThis is aScarfThis is a discounted Shirt
B.
This is a ScarfUncaught TypeError: saleItem.description is not a functionThis is aScarfThis is a discounted Shirt
Answers
C.
This is a ScarfThis is a ShirtThis is a ScarfThis is a discounted Shirt
C.
This is a ScarfThis is a ShirtThis is a ScarfThis is a discounted Shirt
Answers
D.
This is a ScarfThis is a ShirtThis is a discounted ScarfThis is a discounted Shirt
D.
This is a ScarfThis is a ShirtThis is a discounted ScarfThis is a discounted Shirt
Answers
E.
This is aScarfUncaught TypeError: saleItem.description is not a functionThis is a ShirtThis is a did counted Shirt
E.
This is aScarfUncaught TypeError: saleItem.description is not a functionThis is a ShirtThis is a did counted Shirt
Answers
Suggested answer: B

Given the following code:

Let x =('15' + 10)*2;

What is the value of a?

A.
3020
A.
3020
Answers
B.
1520
B.
1520
Answers
C.
50
C.
50
Answers
D.
35
D.
35
Answers
Suggested answer: A

Refer to the following code:

01 function Tiger(){

02 this.Type = 'Cat';

03 this.size = 'large';

04 }

05

06 let tony = new Tiger();

07 tony.roar = () =>{

08 console.log('They\'re great1');

09 };

10

11 function Lion(){

12 this.type = 'Cat';

13 this.size = 'large';

14 }

15

16 let leo = new Lion();

17 //Insert code here

18 leo.roar();

Which two statements could be inserted at line 17 to enable the function call on line 18?

Choose 2 answers.

A.
Leo.roar = () => { console.log('They\'re pretty good:'); };
A.
Leo.roar = () => { console.log('They\'re pretty good:'); };
Answers
B.
Object.assign(leo,Tiger);
B.
Object.assign(leo,Tiger);
Answers
C.
Object.assign(leo,tony);
C.
Object.assign(leo,tony);
Answers
D.
Leo.prototype.roar = () => { console.log('They\'re pretty good:'); };
D.
Leo.prototype.roar = () => { console.log('They\'re pretty good:'); };
Answers
Suggested answer: A, C

Which statement accurately describes an aspect of promises?

A.
Arguments for the callback function passed to .then() are optional.
A.
Arguments for the callback function passed to .then() are optional.
Answers
B.
In a.then() function, returning results is not necessary since callbacks will catch the result of a previous promise.
B.
In a.then() function, returning results is not necessary since callbacks will catch the result of a previous promise.
Answers
C.
.then() cannot be added after a catch.
C.
.then() cannot be added after a catch.
Answers
D.
.then() manipulates and returns the original promise.
D.
.then() manipulates and returns the original promise.
Answers
Suggested answer: A

Given the code below:

Function myFunction(){

A =5;

Var b =1;

} myFunction();

console.log(a);

console.log(b);

What is the expected output?

A.
Both lines 08 and 09 are executed, and the variables are outputted.
A.
Both lines 08 and 09 are executed, and the variables are outputted.
Answers
B.
Line 08 outputs the variable, but line 09 throws an error.
B.
Line 08 outputs the variable, but line 09 throws an error.
Answers
C.
Line 08 thrones an error, therefore line 09 is never executed.
C.
Line 08 thrones an error, therefore line 09 is never executed.
Answers
D.
Both lines 08 and 09 are executed, but values outputted are undefined.
D.
Both lines 08 and 09 are executed, but values outputted are undefined.
Answers
Suggested answer: B

Which two console logs outputs 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/ ''five);
C.
console.log(10/ ''five);
Answers
D.
console.log(10/0);
D.
console.log(10/0);
Answers
Suggested answer: B, C

Given the following code:

Counter = 0;

const logCounter = () => {

console.log(counter);

);

logCounter();

setTimeout(logCOunter, 1100);

setInterval(() => {

Counter++

logCounter();

}, 1000);

What is logged by the first four log statements?

A.
0 0 1 2
A.
0 0 1 2
Answers
B.
0 1 2 3
B.
0 1 2 3
Answers
C.
0 1 1 2
C.
0 1 1 2
Answers
D.
0 1 2 2
D.
0 1 2 2
Answers
Suggested answer: C

Refer to the code below:

Refer to the code below:

Function Person(firstName, lastName, eyecolor) {

this.firstName =firstName;

this.lastName = lastName;

this.eyeColor = eyeColor;

}

Person.job = 'Developer';

const myFather = new Person('John', 'Doe');

console.log(myFather.job);

What is the output after the code executes?

A.
ReferenceError: eyeColor is not defined
A.
ReferenceError: eyeColor is not defined
Answers
B.
ReferenceError: assignment to undeclared variable "Person"
B.
ReferenceError: assignment to undeclared variable "Person"
Answers
C.
Developer
C.
Developer
Answers
D.
Undefined
D.
Undefined
Answers
Suggested answer: D

A developer at Universal Containers creates a new landing page based on HTML, CSS, and JavaScript TO ensure that visitors have a good experience, a script named personaliseContext needs to be executed when the webpage is fully loaded (HTML content and all related files ), in order to do some custom initialization.

Which statement should be used to call personalizeWebsiteContent based on the above business requirement?

A.
document.addEventListener(''onDOMContextLoaded', personalizeWebsiteContext);
A.
document.addEventListener(''onDOMContextLoaded', personalizeWebsiteContext);
Answers
B.
window.addEventListener('load',personalizeWebsiteContext);
B.
window.addEventListener('load',personalizeWebsiteContext);
Answers
C.
window.addEventListener('onload', personalizeWebsiteContext);
C.
window.addEventListener('onload', personalizeWebsiteContext);
Answers
D.
Document.addEventListener('''DOMContextLoaded' , personalizeWebsiteContext);
D.
Document.addEventListener('''DOMContextLoaded' , personalizeWebsiteContext);
Answers
Suggested answer: B

A developer is leading the creation of a new browser application that will serve a single page application. The team wants to use a new web framework Minimalsit.js. The Lead developer wants to advocate for a more seasoned web framework that already has a community around it.

Which two frameworks should the lead developer advocate for?

Choose 2 answers

A.
Vue
A.
Vue
Answers
B.
Angular
B.
Angular
Answers
C.
Koa
C.
Koa
Answers
D.
Express
D.
Express
Answers
Suggested answer: B, D
Total 224 questions
Go to page: of 23