Answer the question
In order to leave comments, you need to log in
How to deal with javascript (node js) asynchrony?
Good afternoon! I study node, I try to overcome asynchrony (without async library)
console.log('start')
let userSearch = (cb)=>{
connection.query("SELECT * FROM `users` WHERE `login` = ?", [data.login], (err, res)=>{
if (err) throw err;
console.log(`result:`);
console.log(fld);
cb(fld);
})
}
console.log(userSearch());
console.log('end')
-start
-end
-мои данные
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