Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add(acc, x) {
- return acc + x
- }
- const xs = [1, 2, 3, 4, 5]
- const sum = xs.reduceRight(add) // look here
- console.log(sum) // still 15 :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement