I have an array of houses which has an array of rooms inside.
Each room, house, and street has a unique ID (eg: If rooms in house 1, have ID 1..4, rooms in house 2 will have ID 5..9)
var street = {
id = 1,
streetname = 'stack street',
houses = [
{
id: 1,
type: 'brick'
rooms: [
{
id: 1,
color: 'blue'
}, ... a bunch more
]
}, ... a bunch more
]
}
Are there easy solutions like arr.findIndex() for:
- Given a room ID, return the index of the house in the array houses, and the index of the room in the array rooms of that house
- Given a room ID, return the house it's in
- Given a room ID, return the room object