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!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
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.
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!