5 ms·
it depends on how you want to structure your code and give sections to code. "if (isConnected) {} else {}" emphasizes to me that there are two branches of code
by joesb 9y ago
it depends on how you want to structure your code and give sections to code.
"if (isConnected) {} else {}" emphasizes to me that there are two branches of code which depends on `isConnected` state. It may have only one thing to do right now. But this is major branch. Future git diff will probably show that the code in the body the branch are added/removed.
Ternary expression emphasizes on modification of a single attribute.