質問編集履歴
2
定義方法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
this.name = name;
|
16
16
|
this.age = age;
|
17
17
|
}
|
18
|
-
nearly_years_old
|
18
|
+
nearly_years_old(){
|
19
19
|
const youngest = this.age - 5;
|
20
20
|
const oldest = this.age +5;
|
21
21
|
const out = new Array();
|
1
変数の変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
```Javascript
|
10
10
|
/*
|
11
|
-
例として、+-5歳の年齢を返す(10歳なら、5~15)
|
11
|
+
例として、+-5歳の年齢を返す(10歳なら、5~15)メソッドを作成します。
|
12
12
|
*/
|
13
13
|
class Person{
|
14
14
|
constructor(name, age){
|
@@ -19,7 +19,7 @@
|
|
19
19
|
const youngest = this.age - 5;
|
20
20
|
const oldest = this.age +5;
|
21
21
|
const out = new Array();
|
22
|
-
for(let
|
22
|
+
for(let i=youngest;i<=oldest;i++){
|
23
23
|
out.push(i);
|
24
24
|
}
|
25
25
|
return out;
|