index.js
/**
    * reduce: It will add values in a reduced array 
    * 
    * @param {Array} collectiony: array with contents within to reduce
    * @param {funciton} iterator: function to pass element, acc, and index of the array
    * @param {*} accumulator: determines first position, if it is not given it will be the first index of the array
    * 
    * @return {*} : will be value of previous value (acc) + current value
    * 
    * 
    * 
    */
It will add values in a reduced array

@param {Array} collectiony: array with contents within to reduce
@param {funciton} iterator: function to pass element, acc, and index of the array
@param {*} accumulator: determines first position, if it is not given it will be the first index of the array

@return {*} : will be value of previous value (acc) + current value
It will add values in a reduced array @param { Array } collectiony : array with contents within to reduce @param { funciton } iterator : function to pass element acc and index of the array @param { * } accumulator : determines first position if it is not given it will be the first index of the array @return { * } : will be value of previous value ( acc ) + current value
function reduce(collection, iterator, accumulator) {
  let previous = accumulator;
  if (accumulator === undefined){
    previous = collection[0];
    each(collection, function(e, i){
      if (i !== 0){
        previous = iterator(previous, e, i);
      }
    });
  } else {
    each(collection, function(e, i){
     previous = iterator(previous, e, i);
    });
  }
  return previous;
  }
function reduce ( collection , iterator , accumulator ) { let previous = accumulator ; if ( accumulator === undefined ) { previous = collection [ 0 ] ; each ( collection , function ( e , i ) { if ( i !== 0 ) { previous = iterator ( previous , e , i ) ; } } ) ; } else { each ( collection , function ( e , i ) { previous = iterator ( previous , e , i ) ; } ) ; } return previous ; }
reduce: It will add values in a reduced array
reduce : It will add values in a reduced array