Git Product home page Git Product logo

array-reduce-right-x's Introduction

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

array-reduce-right-x

Reduce an array (from right to left) to a single value.

module.exports*

This method applies a function against an accumulator and each value of the array (from right-to-left) to reduce it to a single value..

Kind: Exported member
Returns: * - The value that results from the reduction.
Throws:

  • TypeError If array is null or undefined.
  • TypeError If callBack is not a function.
  • TypeError If called on an empty array without an initial value.
Param Type Description
array array The array to iterate over.
callBack function Function to execute for each element.
[initialValue] * Value to use as the first argument to the first call of the callback. If no initial value is supplied, the first element in the array will be used. Calling reduceRight on an empty array without an initial value is an error.

Example

import reduceRight from 'array-reduce-right-x';

console.log(
  reduceRight(
    [0, 1, 2, 3],
    function(a, b) {
      return a + b;
    },
    0,
  ),
); // sum is 6

array-reduce-right-x's People

Contributors

xotic750 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.