我无法从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