回答編集履歴
2
index
test
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
Object.defineProperty(Array.prototype, key, {
|
6
6
|
|
7
|
-
value: function (
|
7
|
+
value: function (index) {
|
8
8
|
|
9
|
-
return "キー値は" +
|
9
|
+
return "キー値は" + index;
|
10
10
|
|
11
11
|
}
|
12
12
|
|
1
/
test
CHANGED
@@ -2,19 +2,13 @@
|
|
2
2
|
|
3
3
|
const key = Symbol('key');
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
function _key(index) {
|
8
|
-
|
9
|
-
return 'key値は' + index + '&' + '値は' + this[index];
|
10
|
-
|
11
|
-
}
|
12
|
-
|
13
|
-
|
14
|
-
|
15
5
|
Object.defineProperty(Array.prototype, key, {
|
16
6
|
|
17
|
-
value:
|
7
|
+
value: function (key) {
|
8
|
+
|
9
|
+
return "キー値は" + key;
|
10
|
+
|
11
|
+
}
|
18
12
|
|
19
13
|
});
|
20
14
|
|
@@ -24,7 +18,7 @@
|
|
24
18
|
|
25
19
|
|
26
20
|
|
27
|
-
arr[key](2) // => '
|
21
|
+
arr[key](2) // => 'キー値は2'
|
28
22
|
|
29
23
|
```
|
30
24
|
|