Last active
September 26, 2017 00:10
-
-
Save matheus-rossi/7bad51d5fb4c9aeb4a656522800750aa to your computer and use it in GitHub Desktop.
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
const convertCurrency = (from, to, amount) => { | |
let countries | |
return getCountries(to).then((tempCountries) => { | |
countries = tempCountries | |
return getExchangeRate(from, to) | |
}).then((rate) => { | |
const exchangedAmount = amount * rate | |
return `${amount} ${from} is worth ${exchangedAmount} ${to}. ${to} can be used in the following countries: ${countries.join(', ')}` | |
}) | |
} | |
convertCurrency('CAD', 'USD', 100).then((status) => { | |
console.log(status) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment