January 2018
Beginner
658 pages
13h 10m
English
Now we want to add the else if clause checking if the body.status property equals OK. If it does, we can go ahead and run these three lines inside of the code block:
console.log(`Address: ${body.results[0].formatted_address}`); console.log(`Latitude: ${body.results[0].geometry.location.lat}`); console.log(`Longitude: ${body.results[0].geometry.location.lng}`);});
If it doesn't, these lines shouldn't run because the code block will not execute. Then we'll test things out inside of the Terminal, try to fetch the address of 00000, and make sure that instead of the program crashing we get our error message printing to the screen. Then we go ahead and mess up the URL in the app by removing ...
Read now
Unlock full access