so i'm working on node.js and i have a global variable which must be changed inside a function and then checked outside it again.
here is my code:
let res = 0;
con.query(check, function(err, result, res) {
if (err) throw err;
console.log(result);
if (result != null) res = 0;
else res = 1;
});
so the variable i want to change is "res" however, the value is never set and the variable is always 0. how can i change it?