Question 18
Consider the following JavaScript code.
class Tshirt { constructor(size, price) { this.size = size this.price = price }}
class LargeTshirt extends Tshirt { constructor() { super('large', 500) }}
class MediumTshirt extends Tshirt { constructor() { super('medium') }}
class Order { constructor(item, count) { this.item = item this.count = count }
totalPrice() { try { return this.item.price * this.count } catch { return 'Some Error' } }}
const t1 = new MediumTshirt()const order = new Order(t1, 5)console.log(order.totalPrice())What will be logged on to console, if executed?
NaN
500
2500
Some Error