Last active
January 14, 2018 08:32
-
-
Save umar-siddiqui/ef8d7d1ff8d1f98f794b32253f75d209 to your computer and use it in GitHub Desktop.
closure exp for currency conversion
This file contains 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 currencyUsd(rate) { | |
return function(amt) { return (amt / rate) + ' USD' } | |
} | |
inrToUsd = currencyUsd(65) | |
krwToUsd = currencyUsd(1058) | |
inrToUsd(65) // 1 USD (65inr is 1usd) | |
krwToUsd(1058) // 1 USD (1058krw is 1usd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment