0
我会尽量简化我的情况:
offenses = {};
$(offenseTableID).find('tr').each(function (rowIndex, r) {
// building JSON object named "offense" with object with
// information from the table row.
// console.log shows It's correct. I typically have 3 rows
// showing different information.
// I am trying to extend offenses with what I constructed.
$.extend(offenses, offense);
});
// after I'm done I'm printing my "offenses" JSON object,
// expecting it to include everything that was added, but even if
// I $.extend multiple times - it only remembers the last JSON
// object that was $.extend'ed Why?
console.log(JSON.stringify(offenses));
$ .extend与其他PARAMS和覆盖第一个参数最后的值赢得 – Saar
任何理由不在数组中存储攻击,只使用array.push? – Saar
所以没有追加JSON对象? – JasonGenX