{"exchangeRate":{"baseCurrency":"UAH","currency":"EUR","saleRateNB":18.7949200,"purchaseRateNB":18.7949200,"saleRate":20.0000000,"purchaseRate":19.2000000},{"baseCurrency":"UAH","currency":"GEL","saleRateNB":8.1500890,"purchaseRateNB":8.1500890},{"baseCurrency":"UAH","currency":"PLZ","saleRateNB":4.4922010,"purchaseRateNB":4.4922010,"saleRate":5.0000000,"purchaseRate":4.2000000}]}
saleRate
и purchaseRate
.const rawObject = {
exchangeRate: [
{
baseCurrency: 'UAH',
currency: 'EUR',
saleRateNB: 18.7949200,
purchaseRateNB: 18.7949200,
saleRate: 20.0000000,
purchaseRate: 19.2000000
},
{
baseCurrency: 'UAH',
currency: 'GEL',
saleRateNB: 8.1500890,
purchaseRateNB: 8.1500890
},
{
baseCurrency: 'UAH',
currency: 'PLZ',
saleRateNB: 4.4922010,
purchaseRateNB: 4.4922010,
saleRate: 5.0000000,
purchaseRate: 4.2000000
}
]
};
const euro = rawObject.exchangeRate.find(obj => (obj.currency === 'EUR'));
console.log(euro);
console.log(`Euro saleRate: ${euro.saleRate}`);
console.log(`Euro purchaseRate: ${euro.purchaseRate}`);