Skip to content

Commit f6f3344

Browse files
authored
Merge pull request #537 from ut-code/sato-increment-age
2 parents f23157f + 7c9fb94 commit f6f3344

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

docs/1-trial-session/11-object/_samples/incrementAge/script.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ function incrementAge(person) {
44
}
55

66
const tanaka = { name: "田中", age: 18 };
7+
const sato = { name: "佐藤", age: 22 };
78
const nextYearTanaka = incrementAge(tanaka);
8-
document.write(nextYearTanaka.age);
9+
const nextYearSato = incrementAge(sato);
10+
document.write(
11+
`田中は ${nextYearTanaka.age} 歳、佐藤は ${nextYearSato.age} 歳`,
12+
);

docs/1-trial-session/11-object/index.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,13 @@ function incrementAge(person) {
143143
}
144144

145145
const tanaka = { name: "田中", age: 18 };
146+
const sato = { name: "佐藤", age: 22 };
146147
const 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

158163
const tanaka = { name: "田中", age: 18 };
164+
const sato = { name: "佐藤", age: 22 };
159165
const 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" />

0 commit comments

Comments
 (0)