January 2018
Beginner
658 pages
13h 10m
English
Before we go ahead and make any changes in geocode.js, we want to take a look at how we'll structure things inside of app.js. We'll pass an arrow function to geocodeAddress, and this will get called after the request comes back:
geocode.geocodeAddress(argv.address, () => {});
In the parentheses, we'll expect two arguments, errorMessage, which will be a string, and results, which will contain the address, the latitude, and the longitude:
geocode.geocodeAddress(argv.address, (errorMessage, results) => {});
Out of these two only one will be available at a time. If we have an error message we'll not have results, and if we have results we'll not have an error message. This will make ...
Read now
Unlock full access