Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const button1 = document.querySelector('#eth');
- const list = document.querySelector('#price');
- const addPrice = async() => {
- const pricee = await checkPrice();
- console.log(pricee)
- const newLI = document.createElement('LI');
- newLI.append(pricee);
- list.append(newLI)
- }
- const checkPrice = async () => {
- axios.get('https://api.cryptonator.com/api/ticker/eth-aud')
- .then(res => {
- //.then(function(res) {
- console.log(res.data.ticker.price)
- return res.data.ticker.price
- })
- .catch(err => {
- console.log('Sorry, error!')
- return 'Sorry, error!'
- })
- }
- button1.addEventListener('click', addPrice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement