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);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter