回答編集履歴
2
誤記の修正
test
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
var arr2 = [];
|
28
28
|
|
29
|
-
console.log(arr.push('foobar')); // hogehoge
|
29
|
+
console.log(arr2.push('foobar')); // hogehoge
|
30
30
|
|
31
31
|
```
|
32
32
|
|
1
補足
test
CHANGED
@@ -34,6 +34,16 @@
|
|
34
34
|
|
35
35
|
|
36
36
|
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
37
41
|
これを踏まえた上で、`[].slice === Array.prototype.slice`が`true`になるのは,
|
38
42
|
|
39
43
|
同一のオブジェクトを指しているためです。
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
ちなみに
|
48
|
+
|
49
|
+
`[].slice() === Array.prototype.slice()` は `false` です。functionの結果生成されたインスタンスを比較している感覚ですね。
|