I think this is easiest to explain with an example.
var my_variable = 10;
let my_sql = "select count(id) as id_count from table";
con.query(my_sql, function (err, my_result) {
if (my_result[0].id_count > 10) {
my_variable += 10;
}
The problem:
The con.query callback function is not able to see the value of my_variable
.