Created
January 7, 2026 17:41
-
-
Save yamoo9/fd2b510f86eff14b5540afd56282553b to your computer and use it in GitHub Desktop.
달러(usd) → 한국 원화로 환산한 금액(정수)을 반환하는 함수
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function convertUsdToKrw(usd, exchangeRate) { | |
| // 데이터 정제 (문자열에서 숫자만 추출) | |
| const numberUsd = parseFloat(usd) | |
| const numberRate = parseFloat(exchangeRate) | |
| // 계산 (달러 * 환율) | |
| const calcValue = numberUsd * numberRate | |
| // 데이터 가공 (소수점 제거 및 정수화) | |
| const result = parseInt(calcValue, 10) | |
| // 최종 결과 반환 (단위 결합) | |
| return result + '원' | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment