【发布时间】:2013-02-12 00:17:56
【问题描述】:
如何更新数组(键、值)对象?
arrTotals[
{DistroTotal: "0.00"},
{coupons: 12},
{invoiceAmount: "14.96"}
]
我想将“DistroTotal”更新为一个值。
我试过了
for (var key in arrTotals) {
if (arrTotals[key] == 'DistroTotal') {
arrTotals.splice(key, 2.00);
}
}
谢谢..
【问题讨论】:
-
js对象数组...
-
JavaScript 中的数组具有数字索引(键)。一旦你把一个非数字的“索引”塞进去,它就不再是一个数组了。
-
@NullUserException 我的错,我以为是
var arrTotals = [ {DistroTotal: "0.00"}, {coupons: 12}, {invoiceAmount: "14.96"} ]
标签: javascript arrays