我在这样的数组中有对象:
[
{ Cool: "29.99" },
{ Cool: "29.99" },
{ Cool: "64.99" },
{ Cool: "32.99" },
{ Whoah: "29.99" },
{ Whoah: "25.99" },
{ Whoah: "19.99" },
{ Neat: "11.99" },
{ Neat: "14.99" },
{ Rad: "29.99" },
{ Tubular: "32.99" }
]
我希望输出看起来像这样:
[
{ Cool: "345.12" },
{ Whoah: "312.60" },
{ Neat: "657" },
{ Rad: "123.45" },
{ Tubular: "678.09" }
]
我将如何实现这一目标?我试过的都没有工作,我怀疑我需要做一些更聪明的事情,而不是迭代数组并拥有一堆嵌套的for of
语句。