While you've shown some nice alternatives for IF, most of these examples feel less readable after being refactored. Especially chaining the ternary operator should be avoided IMHO.
Yes in the refactor, some of semantic is lost. The chaining ternaries is the most extreme. Consider this things as example you can chose use it or not.
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.
While you've shown some nice alternatives for IF, most of these examples feel less readable after being refactored. Especially chaining the ternary operator should be avoided IMHO.
Yes in the refactor, some of semantic is lost. The chaining ternaries is the most extreme. Consider this things as example you can chose use it or not.