Getting the sum of all order_cost in array

hi,

In my angular application I am pushing numbers to an array, so the following:

r[0].order_cost == 269
r[1].order_cost == 369

\\ there may even be another number r[3].order_cost == 123

I would like to sum these numbers in the array ‘r’

so I get TOTAL AMOUNT: 638

Use Array.reduce

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / repl.it / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile: