DEV Community

Discussion on: ✔||🤢 Commit or Vomit | Switch(true)

Collapse
 
asdftd profile image
Milebroke • Edited

I think the cleanest and most expressive is still this


const hasFrontendFrameworkExperience = userHasAngularExperience || userHasReactExperience || userHasVueExperience;

if(userMissedAppointment){
    return 'nope';
} else if(hasFrontendFrameworkExperience && userCanStartInstantly){
    return 'hire';
}
return 'maybe';
Enter fullscreen mode Exit fullscreen mode
Collapse
 
jmdejager profile image
🐤🥇 Jasper de Jager

Your function behaves slightly different than the example, bit this just might prove your point of the switch not being readable enough 😅

The difference is that in the switch an angular experienced used doesn't have to start immediately.

Collapse
 
asdftd profile image
Milebroke

You are definitely right :D Well in that case I wouldn't mind the right if else combo either