如何使用 jQuery 对这样的 JSON 数组的元素求和:
"taxes": [
{ "amount": 25, "currencyCode": "USD", "decimalPlaces": 0, "taxCode": "YRI" },
{ "amount": 25, "currencyCode": "USD", "decimalPlaces": 0, "taxCode": "YRI" },
{ "amount": 10, "currencyCode": "USD", "decimalPlaces": 0, "taxCode": "YRI" }
]
结果应该是:
totalTaxes = 60