I have a code like this
var data = {
"post": {
"time": {
"year": "2017",
"month": "1"
}
}
}
and I want to use multi varible to get the data.post.time
array I have written this code but doesn't work
var type = "post";
var name = "time";
console.log(data.type.name);
But it doesn't output the array of data.post.time
How to fix it?