Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ function incrementAge(person) {
}

const tanaka = { name: "田中", age: 18 };
const sato = { name: "佐藤", age: 22 };
const nextYearTanaka = incrementAge(tanaka);
document.write(nextYearTanaka.age);
const nextYearSato = incrementAge(sato);
document.write(
`田中は ${nextYearTanaka.age} 歳、佐藤は ${nextYearSato.age} 歳`,
);
13 changes: 11 additions & 2 deletions docs/1-trial-session/11-object/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,13 @@ function incrementAge(person) {
}

const tanaka = { name: "田中", age: 18 };
const sato = { name: "佐藤", age: 22 };
const nextYearTanaka = incrementAge(tanaka);
document.write(nextYearTanaka.age); // 19 と表示されてほしい
const nextYearSato = incrementAge(sato);
// 19 歳、23 歳 と表示されてほしい
document.write(
`田中は ${nextYearTanaka.age} 歳、佐藤は ${nextYearSato.age} 歳`,
);
```

<Answer title="年齢を増やす">
Expand All @@ -156,8 +161,12 @@ function incrementAge(person) {
}

const tanaka = { name: "田中", age: 18 };
const sato = { name: "佐藤", age: 22 };
const nextYearTanaka = incrementAge(tanaka);
document.write(nextYearTanaka.age);
const nextYearSato = incrementAge(sato);
document.write(
`田中は ${nextYearTanaka.age} 歳、佐藤は ${nextYearSato.age} 歳`,
);
```

<ViewSource url={import.meta.url} path="_samples/incrementAge" />
Expand Down