SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function reduce(list, callback, initialValue) {
  2.   let accumulator = initialValue;
  3.   for (let currentIndex = 0; currentIndex < list.length; currentIndex++) {
  4.     currentValue = list[currentIndex];
  5.     accumulator = callback(accumulator, currentValue, currentIndex, list);
  6.   }
  7.   return accumulator;
  8. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top