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

Salesforce Certified JavaScript Developer (JS-Dev-101) JavaScript-Developer-I Question # 25 Topic 3 Discussion

Salesforce Certified JavaScript Developer (JS-Dev-101) JavaScript-Developer-I Question # 25 Topic 3 Discussion

JavaScript-Developer-I Exam Topic 3 Question 25 Discussion:
Question #: 25
Topic #: 3

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. There is a new requirement for a developer to implement a description method that will return a brief description for Item and SaleItem.

01 let regItem = new Item( ' Scarf ' , 55);

02 let saleItem = new SaleItem( ' Shirt ' , 80, .1);

03 Item.prototype.description = function() { return ' This is a ' + this.name; }

04 console.log(regItem.description());

05 console.log(saleItem.description());

06

07 SaleItem.prototype.description = function() { return ' This is a discounted ' + this.name; }

What is the output when executing the code above?


A.

This is a Scarf

Uncaught TypeError: saleItem.description is not a function

This is a Scarf

This is a discounted Shirt


B.

This is a Scarf

This is a Shirt

This is a Scarf

This is a discounted Shirt


C.

This is a Scarf

This is a Shirt

This is a discounted Scarf

This is a discounted Shirt


D.

This is a Scarf

Uncaught TypeError: saleItem.description is not a function

This is a Shirt

This is a discounted Shirt


Get Premium JavaScript-Developer-I Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.