I have this example:
var data={
city:{
street:{
houses:[]
}
}
}
alert(data.city.street.houses?.[0].person);
var data={
city:{
street:{
houses:[]
}
}
}
alert(data.city.street.houses?.[0].person);
this would show an error because it does not exist houses[0], how can I avoid having errors but in case houses[0] does exist, continue with the nesting?
doing this, I am getting errors:
how can I do it?

[0]