这个通常是求多个商品的总价遇到的情形:

[
    0: {id: 1, name: "服务费", price: "1.00"}
    1: {id: 2, name: "邮寄费", price: "1.00"}
]

求和总价:

let totalPrice = 0
data.reduce((totalPrice, item) => totalPrice + item.price, 0)

 

相关文章:

  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-25
  • 2022-12-23
  • 2021-08-02
  • 2021-10-22
  • 2022-12-23
  • 2022-01-12
相关资源
相似解决方案