I know that this question has an accepted answer but I thought I'd chip in with an alternative which uses array.reduce, seeing that summing an array is the canonical example for reduce:

Copy$scope.sum = function(items, prop){
    return items.reduce( function(a, b){
        return a + b[prop];
    }, 0);
};

$scope.travelerTotal = $scope.sum($scope.traveler, 'Amount');

Fiddle

Answer from Gruff Bunny on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › reduce
Array.prototype.reduce() - JavaScript - MDN Web Docs
July 20, 2025 - This convention propagates to JavaScript's reduce(): you should use spreading or other copying methods where possible to create new arrays and objects as the accumulator, rather than mutating the existing one. If you decided to mutate the accumulator instead of copying it, remember to still return the modified object in the callback, or the next iteration will receive undefined.
Discussions

javascript - Sum values of objects in array - Stack Overflow
Assuming you already have a sum function for simple arrays of numbers, you can implement a function that will sum the totals of all keys over an array of objects in just two expressions. No loops, hardcoded property names, anonymous functions or if/else required. More on stackoverflow.com
🌐 stackoverflow.com
How do you calculate the sum of values in an array of objects?
This is what `reduce()` is for, processing an array down to a single value. You'll want something like this: const sum = products.reduce((total, product) => {return total + product.price - product.discount}, 0) More on reddit.com
🌐 r/learnjavascript
5
3
July 29, 2019
Define a sum function that accepts an array of numbers OR an array of bigints
What type signature have you tried? I've been out of TS for a bit, but I believe this'll work if you make your function generic, where your argument arr: T[] and T extends number | bigint More on reddit.com
🌐 r/typescript
21
5
May 23, 2024
How to reduce and sum a nested object array?
// reduce product to sum via matching keys const productReducer = (sumObj, product) => { const current = sumObj[product.productName] || 0; return { ...sumObj, [product.productName]: current + product.total } } // reduce product, return [key, product] const hourMapper = ([key, hours]) => { return [key, hours.reduce(productReducer, {})]; } // restore [key, val] array to object const flattenKeyVal = (obj, keyVal) => { return { ...obj, [keyVal[0]]: keyVal[1] } } // obj -> [key,product] -> [key, reducedProduct] -> reducedObj const dayMapper = day => { return Object.entries(day).map(hourMapper).reduce(flattenKeyVal); } // put it all together for the days const mapDays = days => days.map(dayMapper); I believe this should work! Fun little challenge. Let me know if you have any questions. More on reddit.com
🌐 r/learnjavascript
6
2
May 3, 2021
🌐
ReqBin
reqbin.com › code › javascript › m81eb1ms › javascript-sum-array-example
How to get a sum of array elements in JavaScript?
November 24, 2023 - The sum of the array elements will be returned as the result of the array.reduce() method. Alternatively, you can find the sum of array elements using a "for" loop. In this JavaScript Array Sum Example, we use the reduce() method to get the ...
🌐
Sling Academy
slingacademy.com › article › javascript-ways-to-calculate-the-sum-of-an-array
JavaScript: 6 Ways to Calculate the Sum of an Array - Sling Academy
February 19, 2023 - Array.map() method is new in ES6 and beyond. This one is very useful when you have to deal with an array, including finding the sum of its elements.
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-get-sum-of-array-object-values
How to Sum a Property in an Array of Objects in JavaScript | bobbyhadz
March 2, 2024 - Use the reduce() method to iterate over the array. On each iteration increment the sum with the specific value. The result will contain the sum of the values for the specific property.
🌐
Delft Stack
delftstack.com › home › howto › javascript › sum array of objects javascript
How to Sum Array of Objects in JavaScript | Delft Stack
March 11, 2025 - This tutorial demonstrates how to sum an array of objects in JavaScript using various methods, including reduce, forEach, and for...of loops. Learn the best practices for efficiently handling data and summing properties like amounts in your JavaScript projects.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-find-the-sum-of-all-elements-of-a-given-array-in-javascript
Sum of an Array in JavaScript - GeeksforGeeks
July 23, 2025 - The loop goes through each element of the array. Each element is added to the sum variable on each iteration. forEach() method is a built-in method that allows you to run a function on each element in the array. You can use it to add up the numbers.
Find elsewhere
🌐
GitHub
gist.github.com › benwells › 0111163b3cccfad0804d994c70de7aa1
Using Array.reduce to sum a property in an array of objects · GitHub
items = [ { customer_id: 1, id: 1, sum: 123} { customer_id: 1, id: 2, sum: 321} { customer_id: 1, id: 3, sum: 213}, ] var total_sum = items.reduce(function(prev, cur) { return prev + cur.summ; }, 0); console.log(total_sum) -> `NaN` %(
🌐
sebhastian
sebhastian.com › javascript-sum-array-objects
JavaScript code recipe: sum an array of objects | sebhastian
January 18, 2021 - When you call the reduce method on array of objects, you need to always specify the initial value to prevent reduce from using the first object as the initial value. If the cart has quantity data, you can multiply the quantity by price before you add to the sum to the accumulator: let cart = [ { name: "JavaScript book", quantity: 3, price: 4, }, { name: "UGG Women's Hazel Ankle Boot", quantity: 2, price: 79, }, { name: "OXO Good Grips 11-Inch Balloon Whisk", quantity: 5, price: 9, }, ]; // totalPrice is 215 let totalPrice = cart.reduce(function (accumulator, item) { return accumulator + item.quantity * item.price; }, 0);
🌐
EyeHunts
tutorial.eyehunts.com › home › javascript sum array of objects | example code
JavaScript sum array of objects | Example code
April 24, 2023 - By using a combination of reduce() and accessing the desired property within each object, you can quickly and easily calculate the sum. Simple example code. <!DOCTYPE html> <html> <body> <script> var array = [{ "adults": 2, "children": 3 }, ...
🌐
TutorialsPoint
tutorialspoint.com › article › sum-of-array-object-property-values-in-new-array-of-objects-in-javascript
Sum of array object property values in new array of objects in JavaScript
March 15, 2026 - Sum values: If it exists, add the numeric values to the existing entry; otherwise, create a new entry · Type conversion: Use the unary plus operator (+) to convert string numbers to integers · The +marks syntax converts string values to numbers ...
🌐
freeCodeCamp
freecodecamp.org › news › how-to-add-numbers-in-javascript-arrays
JS Sum of an Array – How to Add the Numbers in a JavaScript Array
March 31, 2023 - An array in JavaScript is an object that allows you to store an ordered collection of multiple values under a single variable name and manipulate those values in numerous ways. In this article, you will learn how to calculate the sum of all the numbers in a given array using a few different approaches.
🌐
JavaScript in Plain English
javascript.plainenglish.io › how-to-find-the-sum-of-an-array-of-objects-in-javascript-24965d883bd0
How To Find The Sum of an Array of Objects in JavaScript | by Sam C. Tomasi | JavaScript in Plain English
November 20, 2022 - In a nutshell, it’s about reducing an array of values to a single number. Ok, maybe it is better to give an example. This is a child’s card: Each child has a matched list of actions, some good, some not. Each action corresponds to a value. The sum of… ... New JavaScript and Web Development content every day.
🌐
Sabe
sabe.io › blog › javascript-sum-array-objects
How to get the Sum of Array of Objects in JavaScript - Sabe.io
December 19, 2022 - In this post, we will look at how to sum the values of a specific property in an array of objects in JavaScript.
🌐
YouTube
youtube.com › tuts make
javascript sum array of objects value - YouTube
JavaScript provides several methods to manipulate array of objects, and sum of values array of objects by key can be achieved using different approaches. In ...
Published   December 18, 2023
Views   118
🌐
CoreUI
coreui.io › answers › how-to-sum-an-array-of-numbers-in-javascript
How to sum an array of numbers in JavaScript · CoreUI
September 29, 2025 - With over 25 years of experience in software development and as the creator of CoreUI, I’ve implemented array summation in components like data tables, chart calculations, and financial widgets where accurate total calculations are essential for user interfaces and business logic. From my extensive expertise, the most elegant and functional approach is using the reduce() method with an accumulator. This method is concise, readable, and follows functional programming principles while handling empty arrays gracefully.
🌐
Mish Ushakov
mish.co › posts › sum-and-average-array-of-objects-in-js
Sum and average Array of Objects in JavaScript - Mish Ushakov
October 23, 2021 - const result = sample.reduce((previous, current, index, array) => { Object.keys(current).forEach(key => { current[key] += previous[key] if (index === array.length - 1) current[key] /= array.length }) return current })
🌐
Educative
educative.io › answers › how-to-get-the-sum-of-an-array-in-javascript
How to get the sum of an array in JavaScript
In this method, you iterate and add each item until you reach the last item. function sumArray(array){ let sum = 0 // the sum is initialed to 0 /* js arrays are zero-index based ourArray.length = 5, the initialization block is set to 0.
🌐
TutorialsPoint
tutorialspoint.com › sum-similar-numeric-values-within-array-of-objects-javascript
Sum similar numeric values within array of objects - JavaScript
We will then add the value property to one object and delete the other object from the array. This will be done until we reach the end of the array. On reaching, we would have reduced our array to the desired array. ... const arr = [ {"firstName":"John", "value": 89}, {"firstName":"Peter", "value": 151}, {"firstName":"Anna", "value": 200}, {"firstName":"Peter", "value": 22}, {"firstName":"Anna","value": 60} ]; const sumSimilar = arr => { const res = []; for(let i = 0; i < arr.length; i++){ const ind = res.findIndex(el => el.firstName === arr[i].firstName); if(ind === -1){ res.push(arr[i]); }else{ res[ind].value += arr[i].value; }; }; return res; }; console.log(sumSimilar(arr));