new to Javascript and have a basic question.
Say I have the following array of arrays:
const cities = [
{
"id": 4048332,
"name": "Aurora",
"state": "IN",
"country": "US",
"coord": {
"lon": -84.901337,
"lat": 39.056999
}
},
{
"id": 4048388,
"name": "New Pekin",
"state": "IN",
"country": "US",
"coord": {
"lon": -86.016922,
"lat": 38.505058
}
},
{
"id": 4254010,
"name": "Austin",
"state": "IN",
"country": "US",
"coord": {
"lon": -85.808029,
"lat": 38.758389
}
}
Say I have a variable that is a user input of a city, and if the city matches one of the cities listed in the array return the city ID relative to that array. So if a user inputs "New Pekin", how would I go about getting a return of 4048388? Thank you