Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. const reduce = (fn, initValue, list) => {
  2. if (list.length === 0) {
  3. return initValue
  4. }
  5. const [fst, ...rest] = list
  6. return reduce(fn, fn(initValue, fst), rest)
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement