I have a function which parses the address components of the Google Maps API JSON and then returns the city / locality / route name.
JSON
The getAddre
getAddre
let component = getAddressComponent(addressComponents, 'route'); let route = component ? component : null
you can use the ? operator to check the value is true or false then set the value in javascript null will be false
?
true
false
null