Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!