Created
May 23, 2018 00:13
-
-
Save luxplanjay/2f7661db24d244496c695fc1c1683d77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('https://api.ipify.org?format=json') | |
.then(response => { | |
if (response.ok) return response.json(); | |
throw Error('Error while fetching' + response.statusText); | |
}) | |
.then(data => console.log(data)) | |
.catch(err => console.log(err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment