Created
January 12, 2022 02:35
-
-
Save ancyrweb/0182a7af1c18e442b7df336ebd156e97 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 users = [ | |
{ | |
name: "Jane", | |
balance: 100, | |
}, | |
{ | |
name: "John", | |
balance: 75, | |
}, | |
{ | |
name: "Ellis", | |
balance: 31.3, | |
}, | |
]; | |
const addBalance = (balance, user) => balance + user.balance; | |
const balanceSum = users.reduce(addBalance, 0); // 206.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment