Created
June 16, 2018 13:09
-
-
Save tvalentius/be693082d364b2f0e7e6c1868f1b37e3 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
var bali = [ | |
{ regency:'Jembrana', population:114863 }, | |
{ regency:'Tabanan', population:209308 }, | |
{ regency:'Badung', population:277536 }, | |
{ regency:'Gianyar', population:208443 }, | |
{ regency:'Klungkung', population:79233 }, | |
{ regency:'Bangli', population:106166 }, | |
{ regency:'Karangasem', population:193787 }, | |
{ regency:'Buleleng', population:294418 }, | |
{ regency:'Denpasar', population:403292 } | |
]; | |
var sum = bali.reduce(function(val, element) { | |
return val + element.population; | |
}, 0); | |
console.log(sum) // 1887046 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment