Skip to content

Instantly share code, notes, and snippets.

@adoji92 adoji92/1.js
Created Feb 14, 2018

Embed
What would you like to do?
tterwer
let sum = 0;
for (let i = 0; i < arr.length; ++i) {
const item = arr[i];
sum += item.value;
}
sum = 0
for item in arr:
  sum += item["value"]
let sum = 0;
arr.forEach(function(item) {
  sum += item.value;
});
const sum = arr.reduce(function(accitem) {
  return acc + item.value;
}, 0);
const sum = arr.reduce((acc, item) => acc + item.value0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.