DEV Community

Discussion on: 5 ways to refactor if/else statements in JS functions

 
rasmusvhansen profile image
rasmusvhansen

I think we are both right here.
You are right that there probably is a difference in performance.
And I am right that in the real world it will make no difference*.
I learned to always prefer readability and then profile if something is slow. It is usually not what you think that is slowing you down.

*Except in that 0.001% weird edge case

Thread Thread
 
xtofl profile image
xtofl

Fyi . The c++ tool mentioned would be godboldt.org.