Summer Special Limited Time 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 8w52ceb345

A class was written to represent items for purchase in an online store, and a...

A class was written to represent items for purchase in an online store, and a secondclass

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

...//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.

This is a ScarfUncaught TypeError: saleItem.description is not a functionThis is aScarfThis is a discounted Shirt

B.

This is a ScarfThis is a ShirtThis is a ScarfThis is a discounted Shirt

C.

This is a ScarfThis is a ShirtThis is a discounted ScarfThis is a discounted Shirt

D.

This is aScarfUncaught TypeError: saleItem.description is not a functionThis is a ShirtThis is a did counted Shirt

JavaScript-Developer-I PDF/Engine
  • Printable Format
  • Value of Money
  • 100% Pass Assurance
  • Verified Answers
  • Researched by Industry Experts
  • Based on Real Exams Scenarios
  • 100% Real Questions
buy now JavaScript-Developer-I pdf
Get 60% Discount on All Products, Use Coupon: "8w52ceb345"