So I am not sure why I having such a difficult time with this, but I have an object I am trying to map over to get a value from it.
For example:
let obj = {
"lyzjmpkvbtocygakcoxu": {
"label": "Show Time",
"hour": "12",
"minute": "00",
"period": "p.m.",
"add_time": "enabled",
"bdlmynfythqgyzrhruhw_add_date": "December 01, 2021",
"bdlmynfythqgyzrhruhw_stock": ""
},
"eueuuzvkteliefbnwlii": {
"label": "Show Time",
"hour": "05",
"minute": "00",
"period": "p.m.",
"add_time": "enabled",
"brtmypzvuooqhvqugjbj_add_date": "December 02, 2021",
"brtmypzvuooqhvqugjbj_stock": ""
}
}
I want to be able to get this:
December 01, 2021, December 02, 2021
I was able to do this to get the values and key for “add_time”, however what I want is values for key containing the “…_add_date”.
Object.keys(obj).reduce(
(acc, elem) => {
acc[elem] = obj[elem].add_time;
return acc;
},
{},
);