我無法從PapaParse獲取數據。文檔說函數不返回任何東西。我想將這些數據保存在局部變量中。此代碼:使用來自papaparse的提取數據
papaparse.parse(myData, {
download: true,
delimiter: '\t',
complete: function (results) {
console.log(results.data);
}
});
什麼,我試圖做
let newRes;
papaparse.parse(myData, {
download: true,
delimiter: '\t',
complete: function (results) {
console.log(results.data);
newRes = results.data;
}
});
console.log(newRes); //undefined
可能重複[如何從異步調用返回響應?](https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an - 異步調用) – Andreas