3 ms·
No, all of them do: https://codepen.io/anon/pen/bKKaBy?editors=0010 https://codepen.io/anon/pen/bKKaBy?editors=0010 All of these pass the original array as the
by twiss 8y ago
No, all of them do: https://codepen.io/anon/pen/bKKaBy?editors=0010 https://codepen.io/anon/pen/bKKaBy?editors=0010
All of these pass the original array as the last argument, reduce()'s callback just takes one more argument, hence the confusion in the original codepen. It would indeed be highly surprising if some of these functions passed a copy of the original array.
- konsumer 8y agoah, yeah, forgot acc param in reduce. updated.