Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. const formatAsMoney = (amount, buyerCountry) =>
  2. {
  3. let code = countries[0].code;
  4. let currency = countries[0].currency;
  5. for (let locale of countries){
  6. if(!locale.country === buyerCountry)
  7. {
  8. code = locale.code;
  9. currency = locale.currency;
  10.  
  11. }
  12. return amount.toLocaleString(`en-${code}`,
  13. {
  14. style:'currency',
  15. currency: currency,
  16. currencyDisplay:'symbol'
  17. });
  18. }
  19. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement