void is also useful if you write switch statements like this:
switch (dataKey) { case 'hello': api.sortMyStuff() break case 'how are you': api.sortSomeoneElsesStuff() break default: break }
You can reduce a couple of lines using them this way while maintaining the exact behavior:
switch (dataKey) { case 'hello': return void api.sortMyStuff() case 'how are you': return void api.sortSomeoneElsesStuff() default: return void }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
void is also useful if you write switch statements like this:
You can reduce a couple of lines using them this way while maintaining the exact behavior: