Skip to content

Commit 02cf861

Browse files
committed
introduce shipping getter
1 parent 9844be3 commit 02cf861

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

order.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ class Order {
1919
return Math.max(0, this.quantity - 500) * this.itemPrice * 0.05;
2020
}
2121

22+
get shipping() {
23+
return Math.min(this.quantity * this.itemPrice * 0.1, 100);
24+
}
25+
2226
get price() {
2327
return (
2428
this.basePrice - this.quantityDiscount + Math.min(this.quantity * this.itemPrice * 0.1, 100)

0 commit comments

Comments
 (0)