I have an object in which extended address information (street name, zip code, house number, etc.). I need to check for the existence of a street, a house, and if they do not exist, display an error. The array is below:
const obj = {
"address_components": [
{
"long_name": "10",
"short_name": "100",
"types": [
"street_number"
]
},
{
"long_name": "Engelsa street",
"short_name": "Engelsa street",
"types": [
"route"
]
},
{
"long_name": "Saint-Petersburg",
"short_name": "SPB",
"types": [
"locality",
"political"
]
},
{
"long_name": "Russia",
"short_name": "RU",
"types": [
"country",
"political"
]
},
{
"long_name": "194017",
"short_name": "194017",
"types": [
"postal_code"
]
}
],
"formatted_address": "Engelsa street, 100, Saint-Petersburg, Russia, 194017",
}
question from:
https://stackoverflow.com/questions/65641135/how-to-check-if-a-value-exists-in-an-array-in-an-object-array 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…