Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function currencyConverter([arg1, arg2, arg3]) {
- let monetaryValue = Number(arg1);
- let inputCurrency = arg2;
- let outputCurrency = arg3;
- if ("USD"===(inputCurrency)) {
- monetaryValue *= 1.79549;
- } else if ("EUR"===(inputCurrency)) {
- monetaryValue *= 1.95583;
- } else if ("GBP"===(inputCurrency)) {
- monetaryValue *= 2.53405;
- }
- if ("USD"===(outputCurrency)) {
- monetaryValue /= 1.79549;
- } else if ("EUR"===(outputCurrency)) {
- monetaryValue /= 1.95583;
- } else if ("GBP"===(outputCurrency)) {
- monetaryValue /= 2.53405;
- }
- console.log(`${monetaryValue.toFixed(2)} ${outputCurrency}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement