function status(s) {
const n = parseInt(s.substr(1));
var o = '';
switch(s[0]) {
case 'c':
c.query("SELECT * FROM chapters WHERE id='"+n+"' LIMIT 1", function(e, r) {
if (e) throw e;
o = r[0].t;
});
break;
};
return o;
};
console.log(status('c1'));
How to make this returning variable 'o' from function inside query?