j.Sum of Array of Objects in JavaScript

PHOTO EMBED

Tue Nov 30 2021 23:38:05 GMT+0000 (Coordinated Universal Time)

Saved by @rick_m #javascript

fruits = [
 {  description: 'orange', Amount: 50},
 {  description: 'orange', Amount: 50},
 {  description: 'apple', Amount: 75},
 {  description: 'kiwi', Amount: 35},
 {  description: 'watermelon', Amount: 25},];
const sumall = fruits.map(item => item.amount).reduce((prev, curr) => prev + curr, 0);
console.log(sumall);
content_copyCOPY

https://www.delftstack.com/howto/javascript/sum-array-of-objects-javascript/