teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

Arrayへの変換箇所が説明と異なる点を修正

2017/10/05 03:56

投稿

退会済みユーザー
answer CHANGED
@@ -8,8 +8,8 @@
8
8
  var touchList = Array.prototype.slice.call(
9
9
  application.getElementsByTagName('li')
10
10
  )
11
- .map(elm => elm.getElementsByTagName('img'))
11
+ .map(elm => Array.prototype.slice.call(elm.getElementsByTagName('img')))
12
- .reduce((result, elms) => result.concat(Array.prototype.slice.call(elms)), []);
12
+ .reduce((result, elms) => result.concat(elms), []);
13
13
  ```
14
14
 
15
15
  上記処理では HTMLCollection が Array オブジェジクトとは異なることから、取得結果を都度 Array オブジェクトに変換しています。