导入CSV数据并将其转换为json对象(editarray)后。 我想相应地更新表行。
我应该将editarray的键转换为单个数组(如taskArray,customerEmailArray,customerNameArray)然后更新还是有其他方法吗?
var editArray = [ { 'Task Id*': '279620',
customer_email: 'john@gmail.com',
customer_name: 'John Snow',
tags: ''
},
{ 'Task Id*': '279614',
customer_email: 'joe@gmail.com',
customer_name: 'Joey Tribianni',
tags: ''
}
]
var taskArray = editArray.map(a=>{
var taskId = a["Task Id*"];
return taskId;
});
var customerEmailArray = editArray.map(a=>{
var customerEmail = a["customer_email"];
return customerEmail;
});
var customerNameArray = editArray.map(a=>{
var customerName = a["customer_name"];
return customerName;
});
console.log(taskArray, customerEmailArray, customerNameArray);