更新对象数组列表上的 属性,然后检索更新后的列表
Update a property on list of object array and then retrieve the updated list
我有一个对象数组列表,如图所示 below.I 需要将 moment.tz("2013-11-18 11:55", "America/Toronto");
应用到所有 LastUpdate
属性并检索更新的新 array.So 我怎样才能这样做吗?。我可以使用 underscore.js。提前致谢。
简单循环无法工作的任何原因?
for(var i = 0; i < Progress.length; i++) {
Progress[i].LastUpdate = moment.tz(Progress[i].LastUpdate, 'America/Toronto');
}
或
Progress.forEach(function (x) {
x.LastUpdate= moment.tz(x.LastUpdate, 'America/Toronto');
});
我有一个对象数组列表,如图所示 below.I 需要将 moment.tz("2013-11-18 11:55", "America/Toronto");
应用到所有 LastUpdate
属性并检索更新的新 array.So 我怎样才能这样做吗?。我可以使用 underscore.js。提前致谢。
简单循环无法工作的任何原因?
for(var i = 0; i < Progress.length; i++) {
Progress[i].LastUpdate = moment.tz(Progress[i].LastUpdate, 'America/Toronto');
}
或
Progress.forEach(function (x) {
x.LastUpdate= moment.tz(x.LastUpdate, 'America/Toronto');
});