Created
October 14, 2017 15:15
-
-
Save Fouzyyyy/38165950a9e6f0918a15b76d0c7bcfed to your computer and use it in GitHub Desktop.
Arrow functions: currency converter
This file contains hidden or 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
// At the time of this writing, 1 US dollar = 0.85 Euro | |
const euro = 0.85; | |
let dollarsToEuros = (dollars) => { | |
if (dollars == 0) { | |
return 0; | |
} else { | |
return dollars * euro; | |
} | |
}; | |
// A geeky version of the function :) | |
let dollarsToEuros = (dollars) => { | |
return dollars? dollars * euro : 0; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment