Skip to content

Instantly share code, notes, and snippets.

@EugeneAZDev
Created October 19, 2022 16:48
Show Gist options
  • Save EugeneAZDev/f95d0c0124ebc315e815722c2257605e to your computer and use it in GitHub Desktop.
Save EugeneAZDev/f95d0c0124ebc315e815722c2257605e to your computer and use it in GitHub Desktop.
Switch case sampe
// 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