Created
January 4, 2018 13:19
-
-
Save siddharthray/3896f2068ac7dc33a70588d87bf66b9e to your computer and use it in GitHub Desktop.
JavaScript miscellaneous
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
let calculate = (no1, no2, operation) => { | |
let result; | |
switch (operation) { | |
case 'add': | |
result = no1 + no2; | |
break; | |
case 'subtract': | |
result = no1 - no2; | |
break; | |
} | |
return result; | |
}; | |
console.log(calculate(2,2,'add')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment