function getCatFact() {
var catFact = "";
request('http://catfacts-api.appspot.com/api/facts', function (error, resp, body) {
var jsonObj = JSON.parse(body);
catFact += jsonObj.facts[0];
})
console.log("HERE IT IS: "+catFact);
return "Here is your CatFact" + catFact;
}
Seems very simple but I am doing something wrong. All this function returns is Here is your CatFact.. I tried putting the return inside the request function as well, with no luck. Would love any help.