npm currency-converter-lt 환율

이승훈·2024년 9월 26일

1. 설치

npm install currency-converter-lt

2. 사용

import CurrencyConverter from 'currency-converter-lt';

async function getExchangeRate() {
  let currencyConverter = new CurrencyConverter({ from: "USD", to: "KRW" });
  
  try {
    const rate = await currencyConverter.convert();
    console.log(`현재 원-달러 환율: ${rate}`);
  } catch (error) {
    console.error("환율을 불러오는 도중 오류가 발생했습니다:", error);
  }
}

getExchangeRate();
profile
안녕하세요!

0개의 댓글