Skip to content

Commit 48b7b3b

Browse files
committed
object (added Answer tag bc it didn't exist)
1 parent 7c5e94e commit 48b7b3b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: オブジェクト
33
---
44

5+
import Answer from "@site/src/components/Answer";
56
import Term from "@site/src/components/Term";
67
import ViewSource from "@site/src/components/ViewSource";
78

@@ -71,4 +72,19 @@ const nextYearTanaka = incrementAge(tanaka);
7172
document.write(nextYearTanaka.age); // 19 と表示されてほしい
7273
```
7374

75+
<Answer type="年齢を増やす">
76+
77+
```javascript
78+
function incrementAge(person) {
79+
person.age = person.age + 1;
80+
return person;
81+
}
82+
83+
const tanaka = { name: "田中", age: 18 };
84+
const nextYearTanaka = incrementAge(tanaka);
85+
document.write(nextYearTanaka.age);
86+
```
87+
7488
<ViewSource url={import.meta.url} path="_samples/incrementAge" />
89+
90+
</Answer>

0 commit comments

Comments
 (0)