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 has 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:
1) Given a room id, return the index of the house in array houses, and index of the room in array rooms of that house
2) Given a room id, return the house it's in
3) Given a room id, return the room object