x = 0;
T.get('statuses/user_timeline', function(err, data, response) {
x = data[0].text
});
console.log(x);
I'm using twit to access Twitter's API in node, and can't figure out how to assign data from the API to public variables. All of the examples on its github page use this format. How can I, for instance, get console.log here to print the latest tweet, instead of 0?
Everything with twit itself is working fine. I'm just having this JS problem.