I'm trying to return an array from request but its returning null
request("https://***some url*****/", function (err, resp, body) {
var links_ = [];
if (!err && resp.statusCode === 200) {
var $ = cheerio.load(body);
$('.div-topics-index > ul > li').map(function (i, links) {
links_.push($(links).children('a').attr('href').toString());
});
return links_;
}
});
I tried this also Return value from Request but doesn't worked. So how do I return values from the request in NodeJS?