Having the next object:
2018: {
01: {
01: { key: value }
02: { key: value }
03: { key: value }
},
02: { ... }
},
2019: {
01: ...
How can I simplify the next code used for getting the values into each day object?
for (let yearIndex in obj) {
const year = obj[yearIndex]
for (let monthIndex in year) {
const month = year[monthIndex]
for (let dayIndex in month) {
const day = month[dayIndex] {
console.log(day)
}
}
}
}
The ideal result may be an array with the object of each day:
[{ key: value }, { key: value }, ...]
Object.entries(obj).map(([yearIndex, year]) => Object.entries(year).map(([monthIndex, month]) => ...could also simply further withObject.valuesif you don't care about indicies.response.val()retuning?