Answer the question
In order to leave comments, you need to log in
How to implement iteration with remembering indexes?
I have already encountered this but not in practice, I can’t find a solution to this problem simply because I can’t correctly form a search query, the bottom line is that when iterating over values and executing a query to the database, the function itself remembers only the last index
for( var i in list )
{
connect.query( `SELECT * FROM \`${list[ i ]}\``, ( error, result ) => {
if( error )
{
console.log( error );
}
else
{
object[ list[ i ] ] = object[ list[ i ] ] || {};
object[ list[ i ] ] = result;
}
})
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question