const nameCity = "Name12";
const arr = [{
name: "Name",
region: [
{name: "Name1", cities:[
{name:"Name11", l:1},
{name:"Name12", l:2},
{name:"Name13", l:3}
]},
{name: "Name2", cities:[
{name:"Name21", l:4},
{name:"Name22", l:5},
{name:"Name23", l:6}
]},
{name: "Name3", cities:[
{name:"Name31", l:7},
{name:"Name32", l:8},
{name:"Name33", l:9}
]}
]
}]
arr.forEach(e => {
if(e === nameCity)
console.log(e.l)
});
const arr = [{
name: "Name23",
region: [
{name: "Name1", cities:[
{name:"Name11", l:1},
{name:"Name12", l:2},
{name:"Name13", l:3}
]},
{name: "Name2", cities:[
{name:"Name21", l:4},
{name:"Name22", l:5},
{name:"Name23", l:6}
]},
{name: "Name3", cities:[
{name:"Name31", l:7},
{name:"Name32", l:8},
{name:"Name33", l:9}
]}
]
}]
arr[0].region.forEach((element) => {
element.cities.forEach((zelement) => {
if (arr[0].name === zelement.name) {
console.log(zelement)
}
})
})