Last active
February 11, 2022 04:36
-
-
Save lightsound/a929d5f5e2f289f2686b73856ac8aaf1 to your computer and use it in GitHub Desktop.
Reduce関数ライブ講座で使用したコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 一番シンプルな例 | |
const input = [1, 2, 3, 4]; | |
const output = input.reduce((prev, current) => { | |
return prev + current; | |
}); | |
console.log(output); // 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
オブジェクト配列内のプロパティで
groupBy
する例(TypeScript + 関数の引数で分割代入)