我在第三行收到以下错误:
Can not set property accountName of Undefined
有人可以帮忙吗?
var temp = [];
temp.accountId = newData.Account.Id;
temp.accountType = newData.Account.Type;
temp.accountholder.accountName = newData.Account.Name;
finaloutput.push(temp);
答案 0 :(得分:1)
提前设置temp.accountholder。
var temp =[];
temp.accountId = newData.Account.Id;
temp.accountType = newData.Account.Type;
temp.accountholder = {};
temp.accountholder.accountName = newData.Account.Name;
finaloutput.push(temp);