-
-
Save barraponto/6d7ffc95f8edf25ce6063acba271ca78 to your computer and use it in GitHub Desktop.
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
const convertCurrency = (from, to, amount) => { | |
const countries = getCountries(to); | |
const rate = getExchangeRate(from, to); | |
return Promise.all([countries, rate]) | |
.then(([countries, 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