I know variations of this question have been asked but bear with me.
I have the following array containing objects (which are routines):
const PREMADE_ROUTINES = [
{
itemIds: ['makebed', 'drinkwater', 'quickstretch', 'hotshower', 'brushteeth', 'smallsnack', 'getdressed', 'todolist', 'declutterinbox',],
routineDuration: DEFAULT_ROUTINE_ITEMS.getItemsFromIds(PASS THIS OBJECTS itemIds HERE)
}
]
How could I access the itemIds
in this case within each of the objects in the PREMADE_ROUTINES
array?
In this case, I would need to pass the objects itemIds
as an argument to the function. I could do this if the object wasn't in an array with a get()
. However, I don't know how to do it in this case. Any ideas?
Ideally, I would like to simply access the routineDuration
key by looping and simply accessing it.