Uncaught (in promise) ReferenceError: coin is not defined

введите сюда описание изображенияВсем привет! Пытаюсь получить курс криптовалюты usd-coin, но вылезает ошибка. Весь код снизу

fetch('https://api.coingecko.com/api/v3/simple/price?ids=usd-coin%2CBitcoin%2CEthereum%2CTether%2CRipple%2Cbinancecoin%2C&vs_currencies=usd&include_24hr_change=true&precision=2')
    .then(function (resp) {return resp.json() })
    .then (function (data){
      console.log(data)
        document.getElementById('bitcoin').innerHTML = data.bitcoin.usd
        document.getElementById('ethereum').innerHTML = data.ethereum.usd
        document.getElementById('tether').innerHTML = data.tether.usd
        document.getElementById('ripple').innerHTML = data.ripple.usd
        document.getElementById('bnb').innerHTML = data.binancecoin.usd
        document.getElementById('usdc').innerHTML = data.usd-coin.usd
    })

Как мне кажется ошибка в -, может быть можно ее чем-нибудь заменить


Ответы (1 шт):

Автор решения: sxndwl

Сделал так, все заработало

data['usd-coin'].usd
→ Ссылка