Skip to content

Instantly share code, notes, and snippets.

@dsernst
Created April 11, 2017 12:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsernst/f47b3d99c1ed183e652da02f6343af28 to your computer and use it in GitHub Desktop.
Save dsernst/f47b3d99c1ed183e652da02f6343af28 to your computer and use it in GitHub Desktop.
Translate zip codes into city + state
function getCityByZip(zip) {
fetch(`https://maps.googleapis.com/maps/api/geocode/json?address=${zip}`)
.then(response => response.json())
.then(response => response.results[0].formatted_address)
.then(console.log)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment