DEV Community

Discussion on: Why I'm phasing out ternary statements

Collapse
 
mcgurkadam profile image
Adam McGurk

That's a great question, and a really important one to be asking in the context of refactoring!

I spun up a quick perf test:
jsperf.com/testing-ternary-for-dev...

And it looks like the results are negligible. The first time I ran it, the ternary was faster, the second time I ran it the non ternary was faster.

Feel free to run it yourself!!

Thanks for reading!