Loading...
在 javascript/practice 資料夾下,建立 class.html 來練習。
javascript/practice
class.html
要做杯子蛋糕,就要有做杯子蛋糕的模具(杯子),有了模具(杯子),就可以重覆做出杯子蛋糕。
使用 class 來宣告,以及常搭配 constructor 建構子,以下就是上述概念所說的模具:
class
constructor
做出一個書本:
替模具增加功能,改成以下(加上 show_discount_price 函式):
show_discount_price 函式