0

I'm trying to call a function and for it to return me an object so that I can manipulate it.
I'm doing console.log() at the end to see whether I'm getting the object but not luck.

var SubjTweet = () => T.get('search/tweets', { q: 'banana since:2011-07-11', count: 1 }, function(err, data, response) {
    return data;
  });


console.log(SubjTweet());

I'm looking for an object I can manipulate.

Federico Grandi
  • 6,785
  • 5
  • 30
  • 50
kasm
  • 1
  • You need to use the Promise returned by `SubjTweet`. You can either do this: `SubjTweet().then( obj => { console.log( obj ); } );` or this: `;(async _ => { const obj = await SubjTweet( ); console.log( obj ); }();` – Paul Jan 20 '19 at 18:19
  • Possible duplicate of [How do I return the response from an asynchronous call?](https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call) – Paul Jan 20 '19 at 18:20

0 Answers0