Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JS: does using && condition instead of if have optimization influence

Saying, instead of if (condition) { do something } I use condition && do something. Does it have improvement in optimization?

like image 326
Daneal Avatar asked Dec 08 '25 06:12

Daneal


1 Answers

No. Moreover, if the code needs optimizing, any modern JavaScript engine will do the necessary optimizing for you.

Write clear code. Optimize if and when there's a problem the engine doesn't fix for you.

like image 151
T.J. Crowder Avatar answered Dec 09 '25 20:12

T.J. Crowder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!