score:4

Accepted answer
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.production.min.js"></script>
<div id="react"></div>

score:1

goods = [{
    amount: "11"
  },
  {
    amount: "11"
  },
  {
    amount: "11"
  },
]

let sum = goods.reduce((a, b) => a + parseInt(b.amount), 0)

console.log(sum)

Related Query

More Query from same tag