I have a function that makes a request using the request package. What the function should do is return the 'fact'. But when I call the function it returns undefined.
import request from "request";
const catFact = () => {
request('https://catfact.ninja/fact',(error, response, body) => {
return(body.fact);
});
}
console.log(catFact());