Created
July 18, 2019 17:06
-
-
Save chalu/8a071f0157e2a1db8f44718e3ad9c957 to your computer and use it in GitHub Desktop.
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 computed = data.reduce((sum, {age = 0}, index) => { | |
const value = sum + age; | |
if(index === data.length-1) return value / data.length; | |
return value; | |
}, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment