I have a following object:
var sample =
{
count: {
'20-01-2015/17': {
'a': 553056,
'b': 622123
},
'20-01-2015/18': {
'a': 519008,
'b': 610474
}
}
}
I want to find all the keys for count
property. Also, all the keys for 20-01-2015/17
property also.
var times = Object.keys(sample.count);
console.log(times);
var time = '20-01-2015/17'
//This works
var props = Object.keys(sample.count[time]);
console.log(props);
//But this doesn't work. I am not able to understand that.
props = Object.keys(sample.count.time);
console(props)
I didn't understand why the first approach is working, but not the second one.