Created
August 16, 2019 01:20
-
-
Save edo9k/636654cce1ff87c1df9394838ec1629f to your computer and use it in GitHub Desktop.
Função calc com switch-case.
This file contains 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
calc = (a, b, op) => { | |
switch (op) { | |
case '+': | |
return a + b | |
break | |
case '-': | |
return a - b | |
break | |
case '*': | |
return a * b | |
break | |
case '/': | |
return a / b | |
break | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment