gpt4 book ai didi

javascript - 在对象的对象中访问值

转载 作者:行者123 更新时间:2023-11-30 20:51:08 24 4
gpt4 key购买 nike

<分区>

我正在像这样使用 cryptocompare npm 包

const cc = require('cryptocompare');
cc.priceFull('ETH', 'USD')
.then(prices => {
console.log(prices);
}).catch(console.error)

返回给我的是:

{
ETH: {
USD: {
TYPE: '5',
MARKET: 'CCCAGG',
FROMSYMBOL: 'ETH',
TOSYMBOL: 'USD',
FLAGS: '4',
PRICE: 1152.42,
LASTUPDATE: 1487865689,
LASTVOLUME: 0.21,
LASTVOLUMETO: 242.20349999999996,
LASTTRADEID: 1224703,
VOLUME24HOUR: 53435.45299122338,
VOLUME24HOURTO: 60671593.843186244,
OPEN24HOUR: 1119.31,
HIGH24HOUR: 1170,
LOW24HOUR: 1086.641,
LASTMARKET: 'itBit',
CHANGE24HOUR: 33.11000000000013,
CHANGEPCT24HOUR: 2.958072383879366,
SUPPLY: 16177825,
MKTCAP: 18643649086.5
}
}
}

现在如何获取 CHANGEPCT24HOUR 的特定值 (2.958072383879366)?

尝试了一个 for-in 循环来遍历每个对象,但仍然很吃力。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com