ā||š¤¢ Commit or Vomit | Switch(true)
š¤š„ Jasper de Jager
Posted on April 2, 2021
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.
If (all) else is complicated, switch to switch?
š¤š„ Jasper de Jager ć» Apr 1 '21
#webdev
#programming
#javascript
#discuss
switch(true){
case userMissedAppointment:
return 'nope';
case userHasAngularExperience:
case userHasReactExperience:
case userHasVueExperience && userCanStartInstantly:
return 'hire';
default:
return 'maybe'
}
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! š
š šŖ š
š©
š¤š„ Jasper de Jager
Posted on April 2, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.