File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
docs/1-trial-session/11-object Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -4,5 +4,9 @@ function incrementAge(person) {
44}
55
66const tanaka = { name : "田中" , age : 18 } ;
7+ const sato = { name : "佐藤" , age : 22 } ;
78const nextYearTanaka = incrementAge ( tanaka ) ;
8- document . write ( nextYearTanaka . age ) ;
9+ const nextYearSato = incrementAge ( sato ) ;
10+ document . write (
11+ `田中は ${ nextYearTanaka . age } 歳、佐藤は ${ nextYearSato . age } 歳` ,
12+ ) ;
Original file line number Diff line number Diff line change @@ -143,8 +143,13 @@ function incrementAge(person) {
143143}
144144
145145const tanaka = { name: " 田中" , age: 18 };
146+ const sato = { name: " 佐藤" , age: 22 };
146147const nextYearTanaka = incrementAge (tanaka);
147- document .write (nextYearTanaka .age ); // 19 と表示されてほしい
148+ const nextYearSato = incrementAge (sato);
149+ // 19 歳、23 歳 と表示されてほしい
150+ document .write (
151+ ` 田中は ${ nextYearTanaka .age } 歳、佐藤は ${ nextYearSato .age } 歳` ,
152+ );
148153```
149154
150155<Answer title = " 年齢を増やす" >
@@ -156,8 +161,12 @@ function incrementAge(person) {
156161}
157162
158163const tanaka = { name: " 田中" , age: 18 };
164+ const sato = { name: " 佐藤" , age: 22 };
159165const nextYearTanaka = incrementAge (tanaka);
160- document .write (nextYearTanaka .age );
166+ const nextYearSato = incrementAge (sato);
167+ document .write (
168+ ` 田中は ${ nextYearTanaka .age } 歳、佐藤は ${ nextYearSato .age } 歳` ,
169+ );
161170```
162171
163172<ViewSource url = { import .meta .url } path = " _samples/incrementAge" />
You can’t perform that action at this time.
0 commit comments