Well, I have a function that returns a value for a callback, but I wanted it to return without this callback, is it possible?
Function in question:
function getProfile(id, fn) {
var sql = "SELECT * FROM profiles WHERE ID in ('" + id + "')";
con.query(sql, function (err, result) {
if (err) throw err;
fn(result[0]);
);
}
Code in practice:
var userData = getProfile(123, function(result) {
console.log(result);
});
I wanted the userData
variable to not require callback.