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
🌐
Barbara
geekiebarbs.hashnode.dev › how-to-sum-the-values-of-an-object-in-javascript
How to Sum the Values of an Object in JavaScript - Barbara
August 18, 2023 - const values = Object.values(salaries); const sum = values.reduce((accumulator, value) => { return accumulator + value; }, 0); console.log(sum); // 390 · This is all from today's challenge, hopefully, this makes sense after going through it. Let me know what you think in the comment section and of course, share your thoughts and other possible solutions.
Discussions

Calculating sum in object
Is there another way to find the total sum in an object, What if we had a bunch of properties ? How would you approach this…? cartForParty = {coldrinks:10,beers:10,chips:5,ballons:10,cakes:10}; function calcTotalPrice(cartForParty){ var sum = cartForParty.coldrinks + cartForParty.beers + ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
3
0
September 25, 2019
javascript - Get sum of values in object - Stack Overflow
I have an object that consists of n array items, each containing a name and price key. I'm attempting to retrieve, and sum the values of price in each of the entries. How do I access these values i... More on stackoverflow.com
🌐 stackoverflow.com
javascript - Sum values of objects in array - Stack Overflow
This will empower you to write ... of sum at the top. For the convenience of the reader, here are links to the documentation of each Underscore function used in this snippet, by order of evaluation: _.partial _.reduce _.chain _.map _.keys _.flatten _.uniq _.value _.zip _.object _.mapObject ... More on stackoverflow.com
🌐 stackoverflow.com
jquery - How to sum two object values in javascript - Stack Overflow
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... One more thing, don't use a for loop, merge and extend. Is it possible to sum two objects? More on stackoverflow.com
🌐 stackoverflow.com
June 4, 2017
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › objects: the basics › objects
Sum object properties
Help to translate the content of this tutorial to your language! ... Write the code to sum all salaries and store in the variable sum.
🌐
Codinhood
codinhood.com › nano › js › sum-property-values-object
Sum property values of an object in Javascript | Codinhood
April 8, 2020 - We can use the .reduce() array method on that array to sum up all the values into a single value. The .reduce() method takes a function as a parameter which accepts four arguments but only the first two are important for our purposes: the accumulator and the current value.
🌐
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 - reduce() is a central concept in functional programming, where it's not possible to mutate any value, so in order to accumulate all values in an array, one must return a new accumulator value on every iteration. 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.
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-sum-values-of-object
How to Sum the Values of an Object in JavaScript | bobbyhadz
March 2, 2024 - Alternatively, you can use a for...of loop to iterate over the array. ... Initialize a sum variable to 0 using the let keyword. Use the Object.values() method to get an array of the object's values.
Find elsewhere
🌐
Edureka Community
edureka.co › home › community › categories › web development › java-script › how to sum the values of a javascript object
How to sum the values of a javascript object | Edureka Community
September 25, 2023 - "I'm currently facing an issue while trying to sum the values of a JavaScript object. Can you please ... t been able to get it to work as expected.
🌐
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 - The result will contain the sum of the values for the specific property. ... Copied!const arr = [ {id: 1, salary: 10}, {id: 2, salary: 20}, {id: 3, salary: 30}, ]; const sum = arr.reduce((accumulator, object) => { return accumulator + object.salary; }, 0); console.log(sum); // 👉️ 60
🌐
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 - The reduce() function is a powerful tool in JavaScript that allows you to accumulate values from an array. When summing properties from an array of objects, reduce() is often the go-to method.
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Calculating sum in object - JavaScript - The freeCodeCamp Forum
September 25, 2019 - Is there another way to find the total sum in an object, What if we had a bunch of properties ? How would you approach this…? cartForParty = {coldrinks:10,beers:10,chips:5,ballons:10,cakes:10}; function calcTotalPrice(cartForParty){ var sum = cartForParty.coldrinks + cartForParty.beers + cartForParty.chips + cartForParty.ballons + cartForParty.cakes; return `Your total cart is $${sum}`; } console.log(calcTotalPrice(cartForParty));
🌐
YouTube
youtube.com › watch
How To Sum Object Property Value In Javascript || Javascript Tutorial || Javascript Course || Es6 - YouTube
In this video I have shown how to sum or we can say addition of Object Property Values in Javascript. Javascript Tutorial. Javascript Course.THANKS FOR WATCH...
Published   July 1, 2021
🌐
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);
🌐
Stack Overflow
stackoverflow.com › questions › 71697084 › get-sum-of-values-in-object
javascript - Get sum of values in object - Stack Overflow
You could use the Array.reduce method available in JavaScript. Since you're objects have different keys for "price" you'd want to check which keys are present to add them to the total sum. Reduce takes in an accumulator (running total) and current value(current spot in array.
🌐
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` %(
🌐
TutorialsPoint
tutorialspoint.com › 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
November 21, 2020 - We are required to write a JavaScript function that takes in one such array. The function should eliminate the redundant entries on the basis of the 'subject' property of objects.
🌐
DEV Community
dev.to › ramonak › javascript-how-to-merge-multiple-objects-with-sum-of-values-43fd
Javascript: how to merge multiple objects with sum of values - DEV Community
March 2, 2020 - How can we merge all these objects (baskets) into one and count total sum of each fruit? Let’s create helper method. const mergeFruits = data => { const result = {}; //(1) data.forEach(basket => { //(2) for (let [key, value] of Object.entries(basket)) { //(3) if (result[key]) { //(4) result[key] += value; //(5) } else { //(6) result[key] = value; } } }); return result; //(7) };