This has been getting to me for a while. So, I am trying to create a function that uses request and returns body of the request, using the request node module. Here is my code:
req = require("request")
foo = req("https://www.youtube.com", function(err, resp, body){
bar = body
})
console.log(bar)
This, sadly, returns ReferenceError: bar is not defined
Anyone able to help? Please test your answer before you post it, because I have tried almost EVERYTHING I can think of.