DEV Community

Discussion on: Object Lookups over Switch Statements and If/Else Conditionals

Collapse
 
jankapunkt profile image
Jan Küster

Just in case you ever use a switch, the default case should be used to throw an error to reflect an unexpected state.

Collapse
 
laurenclark profile image
Lauren Clark

Yes in this case, not found. I agree it should have proper error handling but I'm not going to go into that for the purposes of this example.