Home

function: reduceRight


reduceRight(collection: Array, Object, iteratee: function, accumulator: *): *

This method is like `reduce` except that it iterates over elements of `collection` from right to left.

Example(s):

const array = [[0, 1], [2, 3], [4, 5]]

reduceRight(array, (flattened, other) => flattened.concat(other), [])
// => [4, 5, 2, 3, 0, 1]

Params:

Name Type Attribute Description
collection The collection to iterate over.
iteratee The function invoked per iteration.
accumulator The initial value.

Returns:

*

  {
    "comment": "/**\r\n * This method is like `reduce` except that it iterates over elements of\r\n * `collection` from right to left.\r\n *\r\n * @since 0.1.0\r\n * @category Collection\r\n * @param {Array|Object} collection The collection to iterate over.\r\n * @param {Function} iteratee The function invoked per iteration.\r\n * @param {*} [accumulator] The initial value.\r\n * @returns {*} Returns the accumulated value.\r\n * @see reduce\r\n * @example\r\n *\r\n * const array = [[0, 1], [2, 3], [4, 5]]\r\n *\r\n * reduceRight(array, (flattened, other) => flattened.concat(other), [])\r\n * // => [4, 5, 2, 3, 0, 1]\r\n */",
    "meta": {
        "range": [
            758,
            1010
        ],
        "filename": "reduceRight.js",
        "lineno": 23,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100007566",
            "name": "reduceRight",
            "type": "FunctionDeclaration",
            "paramnames": [
                "collection",
                "iteratee",
                "accumulator"
            ]
        },
        "vars": {
            "func": "reduceRight~func",
            "initAccum": "reduceRight~initAccum"
        }
    },
    "description": "This method is like `reduce` except that it iterates over elements of\r`collection` from right to left.",
    "since": "0.1.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Collection",
            "value": "Collection"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array",
                    "Object"
                ]
            },
            "description": "The collection to iterate over.",
            "name": "collection"
        },
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "The function invoked per iteration.",
            "name": "iteratee"
        },
        {
            "type": {
                "names": [
                    "*"
                ]
            },
            "optional": true,
            "description": "The initial value.",
            "name": "accumulator"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "*"
                ]
            },
            "description": "Returns the accumulated value."
        }
    ],
    "see": [
        "reduce"
    ],
    "examples": [
        "const array = [[0, 1], [2, 3], [4, 5]]\r\rreduceRight(array, (flattened, other) => flattened.concat(other), [])\r// => [4, 5, 2, 3, 0, 1]"
    ],
    "name": "reduceRight",
    "longname": "reduceRight",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000692",
    "___s": true,
    "filepath": "reduceRight.js"
}