Skip to content

Instantly share code, notes, and snippets.

@Fouzyyyy
Created October 14, 2017 15:15
Show Gist options
  • Save Fouzyyyy/38165950a9e6f0918a15b76d0c7bcfed to your computer and use it in GitHub Desktop.
Save Fouzyyyy/38165950a9e6f0918a15b76d0c7bcfed to your computer and use it in GitHub Desktop.
Arrow functions: currency converter
// 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