Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. const convertCurrency = (from, to, amount) => {
  2. const countries = getCountries(to);
  3. const rate = getExchangeRate(from, to);
  4. return Promise.all([countries, rate])
  5. .then(([countries, rate]) => {
  6. const exchangedAmount = amount * rate
  7. return `${amount} ${from} is worth ${exchangedAmount} ${to}. ${to} can be used in the following countries: ${countries.join(', ')}`
  8. })
  9. }
  10.  
  11. convertCurrency('CAD', 'USD', 100).then((status) => {
  12. console.log(status)
  13. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement