I've tried so many things so far. I want csvData to equal the result of the data (after it's gone through d3's csv function) but I can only console log the data inside the function and not ever save it to a variable to be used later. It's either save as a promise or continue to be an empty array. What am I doing wrong?
let csvData = [];
let loadData = async function (csvData) {
await csv("data.csv", (d) => d).then(data => (csvData = data));
}
loadData(csvData);
console.log(csvData);