βœ”||🀒 Commit or Vomit | Switch(true)

🐀πŸ₯‡ Jasper de Jager - Apr 2 '21 - - Dev Community

In my recent post I questioned the use of a switch instead of an if else statement. This gave me the idea of an recurring item for dev.to: Commit or Vomit! Would you commit this code or not.

It's going to be code snippets that are going to be evaluated here. Not posts because I don't want people to feel/be judged by this, only code!

So this first βœ”||🀒 is from the post that started it all.


switch(true){
    case userMissedAppointment:
        return 'nope';
    case userHasAngularExperience:
    case userHasReactExperience:
    case userHasVueExperience && userCanStartInstantly:
        return 'hire';
    default:
        return 'maybe'
}
Enter fullscreen mode Exit fullscreen mode

This is just an example but the question is about the switch(true). What do you think? βœ”||🀒

❀: Commit
🏷: Vomit (we all know unicorns don't vomit)
πŸ¦„: Like your post please continue this series!

Looking forward to your reactions! 😎

. . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player