Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

295
Vistas
how i can resolve javascript error :coin.js:16 Uncaught TypeError: Cannot read properties of undefined (reading 'inr')
var car = document.getElementById("Cardano");
var bin = document.getElementById("Binance Coin");
var pol = document.getElementById("Polygon");

var liveprice = {
    "async": true,
    "scroosDomain": true,
    "url": "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cethereum%2Cdogecoin%2Clitecoin%2CCardano%2CBinanceCoin%2CPolygon%2CYearn.finance%2CXRP%2CTron&vs_currencies=inr",
    "method": "GET",
    "headers": {}
}

$.ajax(liveprice).done(function (response){

    car.innerHTML = response.Cardano.inr;
    bin.innerHTML = response.BinanceCoin.inr;
    pol.innerHTML = response.Polygon.inr; 
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The error is telling you that the property inr doesn't exist. You're using it in three places, so you'll need to console.log the response and find which one it is:

car.innerHTML = response.Cardano.inr;
bin.innerHTML = response.BinanceCoin.inr;
pol.innerHTML = response.Polygon.inr; 

Looking at the response from the api (which doesn't require an api key...) I can see that all of the properties are lower case, so none of your references will work.

I can also see that Polygon doesn't exist at all. So your code should be something like:

car.innerHTML = response.cardano.inr;
bin.innerHTML = response.binancecoin.inr;
// pol.innerHTML = response.Polygon.inr; Doesn't exist

It's always a good practice to make sure the property exists on an object before referencing it. A couple of ways are

if ('cardano' in response) {
  car.innerHTML = response.cardano.inr
}

Or

if (response['cardano'] !== undefined) {
  car.innerHTML = response.cardano.inr
}

Or

if (Object.keys(response).indexOf('cardano') > -1) {
  car.innerHTML = response.cardano.inr
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda