This is my code as of now:
function doquery(select,from,where,value){
return new Promise((resolve, reject) => {
con.query("SELECT " + select + " FROM " + from + " WHERE " + where + " = " + value, (err, res, fields) => {
resolve(res);
});
});
};
const username = async function() {
const data = await doquery('name','members','id',1);
return (data);
};
username().then(v => {
console.log(v);
});
what I want is to be able to have console.log(v)
OUTSIDE the function and still produce the same result, something like:
console.log(username);
is it possible?
Thank you.