docker exec
to interact with running containersRead up on how to interact with running containers using the docker exec command, and discover the difference between exec and attach.
filter()
method in JavaScriptLearn about the array filter() method, from its basic syntax and use cases to more advanced techniques like chaining with map() and reduce().
CSS has come a long way, making vertical alignment easier than ever. Learn about this concept and explore some of the best CSS vertical alignment techniques.
Use Flutter to build browser-based app demos that help clients visualize the product, speed up buy-in, and close deals faster.
3 Replies to "Refactoring cascading conditionals in favor of readability"
Nice article, just one thing I’m not sure I’d the best advice, particularly to beginners –
It’s often not considered a best practice to use `&&` and `||` operators as control flow.
The main priority in code design should be readability, and for someone reading these, it primarily implies just a Boolean expression, rather than control flow. If/else is explicit control flow and so it’s much clearer, particularly when it’s contains side affects.
Another problem with this approach is that it suggests fewer lines is better, when in some cases, like this one, fewer lines is just increasing the information density, and not making anything clearer.
Wow… Awesome, thanks
Excellent suggestions! All small readability improvements that my coworkers and I have been adopting recently. A fun note, for those using typescript and map objects, try using Record.