Skip to content

Learn: Array.prototype.reduce() #1093

@ryotamurakami2fb

Description

@ryotamurakami2fb

Goal

reduce の使い方を理解する。

Why

コードベースで reduce を見かけたときに、すぐに読み解けるようになりたい。

Topics

  • 基本的な accumulator / currentValue の流れ
  • initialValue の有無による挙動の違い
  • Object への集約パターン(groupBy 的な使い方)
  • reduce vs forEach / map / filter — 使い分け
  • TypeScript での型推論(ジェネリクス指定)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions