I have a function like this:
var api = {
getProduct : function(callback){
//code anything
//resp data
if(typeof callback == "function") callback(resp);
}
}
There is anyway use like
var data = api.getProduct(function(resp){
return resp;
});
console.log(data);
I need do something outside callback