All I basically want to do is to be able to use the return value from an asynchronous function. I assumed the variable tag (in the code below) would contain the return value from the async function but it rather contains the response. How could I possibly get hold of the return value from the aRes function into a variable that I can use outside the scope of the async function. Thank you in advance.
var http = require('http');
var url = "someurl.com"
//async function to be passed to http.get as second parameter
function aRes(response){
var newtag = response.headers.etag;
return newtag;
}
var tag = http.get(url,aRes);
console.log(tag); //logs the response from get request
//tag is not the return value from the ares function but rather the response object. How do I get the return value of that?