Created
February 22, 2018 16:42
-
-
Save deadlysyn/f4a6d414aef7442724993a02bff463ac to your computer and use it in GitHub Desktop.
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 | |
const btnFetch = document.querySelector('#btnFetch') | |
btnFetch.addEventListener('click', function() { | |
fetch(API) | |
.then(function(res) { | |
res.json() | |
.then(function(data) { | |
PRICE.textContent = data.bpi.USD.rate + ' USD' | |
}) | |
}) | |
.catch(function(err) { | |
console.log(err) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment