Created
October 19, 2022 16:48
-
-
Save EugeneAZDev/f95d0c0124ebc315e815722c2257605e to your computer and use it in GitHub Desktop.
Switch case sampe
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
// Could be async function | |
// Output => Result: 52 | |
function someFunction (args) { | |
switch (args) { | |
case 'first': | |
const r = 1 * 56 | |
const ar = r - 4 | |
return ar | |
case 'second': | |
return 2 | |
default: | |
return 'Some specific result here.' | |
} | |
} | |
const result = someFunction('first') | |
console.log(`Result: ${result}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment