@coderfrankfurt Which one of these centers the div
@coderfrankfurt Like everything, depends on context, but I tend to make enums to use in switches
@coderfrankfurt A JSON object where the key is the switch key and the value is the function to be performed 😉
@coderfrankfurt None 😱. Just kidding, if/else, I code in Python 😅😂😂
@coderfrankfurt but i prefer, const adminCheck = ( user ) => { if ( !user ) return ; if ( !user.auth ) return ; if ( !user.auth.admin ) return ; console.log('Welcome Admin') }
@coderfrankfurt I will use switch/case any opportunity it will work.
@coderfrankfurt I can proudly say I recently just used my first switch case conditional somedays ago 😂😂😂 Wanted to try something new 🙂
@coderfrankfurt Depends Only one or two cases? If/else Many cases? Switch
@coderfrankfurt Well, both is useful for specific situation.
@coderfrankfurt switch is actually cool but most devs prefer if else due to the easy syntax
@coderfrankfurt "I prefer switch case, it's like a multiple choice question instead of a long essay with if-else!" 🤓
@coderfrankfurt I think most people don't have full command over Switch Cases 😂😅.
@coderfrankfurt Switch if more than 3 cases.
@coderfrankfurt Switch case is not conventional to many but it is lovely 👌
@coderfrankfurt If the logic is divided based on one parameter (typically an enum), I always choose switch.
@coderfrankfurt Switch case was introduced in python and I haven't seen a single codebase that even has it.
@coderfrankfurt A perfect example of people don't choose convenience most of the time I prefer switch case
@coderfrankfurt Clarity is the goal of all coding. In general if for simple dichotomies and switch for multi value decisions.
@coderfrankfurt If else... that break, switch, default.. case... too much!
@coderfrankfurt I prefer if...else over switch because relational and logical operators cannot be used in stating the conditions in the case of switch statements.
@coderfrankfurt I just remembered switch case exists i forgot