Created
September 2, 2019 12:40
-
-
Save codebubb/391ac187dc7a9c20b95b8088b3de2168 to your computer and use it in GitHub Desktop.
How to get IP address with JavasScript
This file contains hidden or 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(results => results.json()) | |
| .then(console.log) // e.g. { ip: "113.114.194.164" } | |
| .catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment