Answer the question
In order to leave comments, you need to log in
Accessing data outside of an async function?
I need access to the data array outside of someFun, outside of the loop.
How to get out?
var data = [];
while(i<10)
{
someFun(i, function(array){
data[i] = array[i];
});
i++;
}
console.log(data[0])
Answer the question
In order to leave comments, you need to log in
What is hardcore? Why do an asynchronous operation in a loop?
https://developer.mozilla.org/en/docs/Web/JavaScri...
Use this to make your life better.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question