Sign in

Newton/m²

@newtondividedbysqm.dev
828 followers 132 following 12 posts

🐈 Cat-Dad 👨‍💻 Software Development with #ElixirLang, Typescript, ReactJS, Laravel & #PHP 🐳 Self-Hosting OSS on Docker 📋Agile, TDD, Clean Code 🚑 First Responder [Disclaimer: Avatar/Header AI generated - to be replaced]

PostsRepliesMedia
Newton/m² @newtondividedbysqm.dev · 10/03/2025
Does anyone here has strong opinions on using ternary operators for their side effect? Imho a small side effects can drastically improve code readability, alltough i agree that in most cases using side effects would be considered code smell
typescript code snippet of a return statement which uses the ternary operator while making use of side effects to call a function in addition to returning a value, while only the value is returned.

the code-snippet reads the following:
return (condition) ? (someFunction(), someValue) : (otherFunction(), otherValue)
110