Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138134

how to access elements from this object in javascript?

$
0
0

i was trying to get number of hashtags used at specific time using twitter api and an npm module hashtag-count.this is the program and the results is generating the object below.

var HashtagCount = require("hashtag-count")
require('dotenv').config();

var hc = new HashtagCount({
  'consumer_key': process.env.CONSUMER_KEY,
  'consumer_secret': process.env.CONSUMER_SECRET,
  'access_token': process.env.ACCESS_TOKEN,
  'access_token_secret': process.env.ACCESS_TOKEN_SECRET
});

// //giving the hashtags for which we want to see the count
 var hashtags = ['a', 'b', 'c'];
// //time interval
 var interval = '10 seconds';
//time limit for the program
var limit = '30 seconds';
var finishedCb = function (err, results) {
  if (err) {
    console.error(err);
  } else {
      console.log(results);
  }
};
//initializing.
hc.start({
  hashtags: hashtags,       
  interval: interval,       
  limit: limit,             
  finishedCb: finishedCb,   
});

{
  '2020-01-10T22:46:36.042Z': { a: 1, b: 9, c: 16 },
  '2020-01-10T22:46:46.048Z': { a: 0, b: 10,c: 12 },
  '2020-01-10T22:46:56.063Z': { a: 2, b: 8, c: 15 }
}

this is the object that i have and i would like to get the values of a , b and c from this object.


Viewing all articles
Browse latest Browse all 138134

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>