我正在 node.js 上构建一个程序,用于扫描某些货币的价格,并且我正在获取价格,但是我希望该程序也记录货币的名称,而不仅仅是价格。正如您在下面的代码中看到的,console.log 中的“currency”变量是我在记录价格之前尝试显示名称的尝试。
const currencies = [euro, yen];
for (let currency of currencies) {
const pair = await fetchPairData(currency, dollar);
const route = new Route([pair], dollar);
console.log(currency + route.midPrice.toSignificant(6));
}
但似乎货币变量想要返回与其关联的值,而不是货币名称......我该如何切换?谢谢大家的帮助,我会一步步做好的!
哆啦的时光机
相关分类