File tree Expand file tree Collapse file tree 4 files changed +12
-12
lines changed
docs/2-browser-apps/03-class Expand file tree Collapse file tree 4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 22< html lang ="ja ">
33 < head >
44 < meta charset ="utf-8 " />
5- < title > Title </ title >
5+ < title > Car クラス </ title >
66 </ head >
77 < body >
88 < script src ="./script.js "> </ script >
Original file line number Diff line number Diff line change 1+ class Car {
2+ weightInTons = 1 ;
3+ cost ;
4+ }
5+
6+ const prius = new Car ( ) ;
7+ prius . cost = 2600000 ;
8+
9+ document . write ( `重さは${ prius . weightInTons } tで、値段は${ prius . cost } 円です。` ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -62,9 +62,9 @@ document.write(emptyFunction()); // 値を返さない関数の戻り値は unde
6262
6363### 課題
6464
65- ` weight ` と ` cost ` をプロパティとして持ち、 ` weight ` のデフォルト値が ` "1t" ` であるクラス ` Car ` を作成し、 ` cost ` に好きな値を代入してみましょう。
65+ ` weightInTons ` と ` cost ` をプロパティとして持ち、 ` weightInTons ` のデフォルト値が ` 1 ` であるクラス ` Car ` を作成し、 ` cost ` に好きな値を代入してみましょう。
6666
67- <ViewSource url = { import .meta .url } path = " _samples/class- car" />
67+ <ViewSource url = { import .meta .url } path = " _samples/car-class " />
6868
6969## <Term >メソッド</Term >
7070
You can’t perform that action at this time.
0 commit comments