Q:

How to set/edit variables in Object.keys

I'm trying to use use Object.keys in a map function but i'm getting keys based on map value variable but it's giving me error my data object as you can see i'm trying to get the keys of Display and coin value from map variable and the coin value is in the array at the end but it's giving me error
in short i'm want to get the keys of every object in display child object and display child key will be from my coin name array  so i don't have to hardcode it 
 {this.props.crypto_head_coins.map(coin => {
 return (
      <div key={coin} className="crypto_head">
        <span>{coin} </span>
         {console.log(Object.keys(this.props.crypto_head_data.DISPLAY.coin))}
        <p>{this.props.crypto_head_data.DISPLAY.BTC.USD.PRICE}</p>
      </div>
   );
  })}

A:

This does not work, because DISPLAY is expected to have a literal key called "coin".

Object.keys(this.props.crypto_head_data.DISPLAY.coin);

This will work, because you are referencing the variable coin as a possible key in DISPLAY.

Object.keys(this.props.crypto_head_data.DISPLAY[coin]);

{
  this.props.crypto_head_coins.map(coin => {
    return (
      <div key={coin} className="crypto_head">
        <span>{coin}</span>
        {console.log(Object.keys(this.props.crypto_head_data.DISPLAY[coin])}
        <p>{this.props.crypto_head_data.DISPLAY.BTC.USD.PRICE}</p>
      </div>
    );
  });
}

