I'm using request and Node JS to get source code from a webpage and stock it in a variable in order to work on it after.
var request = require('request');
var htmldata="";
request('https://www.nba.com', function (error, response, body) {
htmldata=body;
});
console.log(htmldata);
I want the variable htmldata to get the value of the parameter of the function body which contains the source code but it returns me a blank string.
I thank you in advance if you resolve my problem