File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
docs/2-browser-apps/03-class Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -111,17 +111,16 @@ tanaka.introduceSelf();
111111
112112### 演習
113113
114- 自分自身の年齢を 1 増やすメソッド ` incrementAge ` を定義して、実行してみてください 。
114+ 自分自身の年齢を 1 増やすメソッド ` incrementAge ` を定義して、今年の自己紹介と 1 年後の自己紹介を表示してみてください。田中さんの年齢は好きな値で構いません 。
115115
116116<Answer title = " 年齢を増やすメソッド" >
117117
118118``` javascript
119119class Student {
120120 name;
121- age = 18 ;
121+ age;
122122 introduceSelf () {
123- document .write (` 私の名前は${ this .name } です。` );
124- document .write (` ${ this .age } 歳です` );
123+ document .write (` 私の名前は${ this .name } です。${ this .age } 歳です。` );
125124 }
126125 incrementAge () {
127126 this .age += 1 ;
@@ -269,7 +268,7 @@ class FreshmanStudent extends Student {
269268 }
270269}
271270
272- const tanaka = new FreshmanStudent (" 田中" , " 18 " , " ドイツ語" );
271+ const tanaka = new FreshmanStudent (" 田中" , 18 , " ドイツ語" );
273272tanaka .introduceSelf (); // 私の名前は田中です。18歳です。ドイツ語選択です。
274273```
275274
You can’t perform that action at this time.
0 commit comments