Skip to content

fesebuv/reduce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reduce

reduce() is an array method that works by applying an accumulator to each element in the array in order to simplify it into a single value.

Example

[1,2,3].reduce(function (accumulator, current) {
  return accumulator + current;
});

// should return 6

You may also pass an initial value for instance:

[1,2,3].reduce(function (accumulator, current) {
  return accumulator + current;
}, 10);

// should return 16

The code found on this repository is an implementation of the reduce method. Furthermore, it can be used as a polyfill.

Releases

No releases published

Packages

No packages published