getRevenueByID function being called in async function, however getting an Uncaught SyntaxError. What am I doing wrong here?
(async() =>{
try {
response = await fetch(mainURL);
data = await response.json();
console.log(data);
console.log(data.results[0].title);
ID_Array = [].concat.apply([], data.results.map(d => d.id))
console.log(ID_Array);
getRevenueByID(ID_Array);
} catch (error) {
console.log(error);
}
})();
getRevenueByID = (arr => {
for (let i = 0; i < arr.length; i++){
console.log("ID is: ", arr[i]);
getRevenueURL = await fetch('someurl' + arr[i] + '?api_key=YOUR_KEY&language=en-US');
console.log(getRevenueURL);
// let data = await getRevenueURL.json();
// console.log(data);
}
});
awaita function call from directly inside anasyncfunction.