Use `toArray` to remove duplication

`list.slice()` is defined in `toArray`.
Merge pull request #2449 from tricknotes/use-toArray

Use `toArray` to remove duplication