Created
February 27, 2020 13:04
-
-
Save just1and0/b477f2a9cb741ad15f045031fdf690bd 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
// data | |
var data = [{"name":"ramu","id":"719","gmail":"[email protected]","ph":988989898,"points":36}, | |
{"name":"ravi","id":"445","gmail":"[email protected]","ph":4554545454,"points":122}, | |
{"name":"karthik","id":"866","gmail":"[email protected]","ph":2332233232,"points":25}] | |
// sum all data in points | |
var result = data.reduce(function(tot, arr) { | |
// return the sum with previous value | |
return tot + arr.points; | |
// set initial value as 0 | |
},0); | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment