Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement