var a = [];
var i;
a.push({ key: "key1", value: 23 });
a.push({ key: "key2", value: 123 });
for (i = 0; i < a.length; i++) {
if (a[i].key == "key23") { break; }
}
if (i == a.length) {
a.push({ key: "key23", value: 33 });
} var b = "";
a.forEach(v=> b += v.key + ":" + v.value + ",");
b=b.substr(0,b.length-1);
.toFixed(2) 小数多的问题