I have a function that performs fetch and processes this data:
async function fetchData(){
const res = await fetch("./data.json");
const data = await res.json();
// processing one-time code
function doSome() {
// code that looks for something in data and processes it(I'm going to call this function many times)
}
doSome()
}
fetchData();
I can call the doSome function inside fetchData, but I need to call doSome outside fetchData.
How can I not process one-time code and only run doSome?