I have an array with data from an API.
Here is the data from the API.
[
  {
    "id": "litecoin",
    "name": "Litecoin",
    "symbol": "LTC",
    "rank": "6",
    "price_usd": "48.5624",
    "price_btc": "0.0128526",
    "24h_volume_usd": "198794000.0",
    "market_cap_usd": "2576800216.0",
    "available_supply": "53061632.0",
    "total_supply": "53061632.0",
    "percent_change_1h": "-1.98",
    "percent_change_24h": "6.07",
    "percent_change_7d": "-0.51",
    "last_updated": "1506172141",
    "price_eur": "40.637987568",
    "24h_volume_eur": "166354795.08",
    "market_cap_eur": "2156317957.0"
  }
]
I am trying to get price_eur. I know I can do this with
data.price_eur
The thing is eur can change to any other currency. So if I want to get USD is use
data.price_usd
But the currency will be variable. So I want to make the text after 'price_' variable.
I have tried something and have no succes yet. Here is what I have tried.
inputCrypto = 'eur';        
var priceCURCrypto = 'price_' + inputCrypto;
var priceCUR = data[0].priceCURCrypto;
Can someone tell how to use a variable when looking through an array.
 
     
     
    