loading...

Discussion on: The Empty Statement in JavaScript

Collapse
jtenos profile image
Joe Enos

For those examples, rather than commenting, I'd just stick with an empty block for clarity:

for (...whatever...) { }

or

if (a) {
    doSomething();
} else if (b) {
} else if (c) {
    doSomethingElse();
}

Fewer characters and you won't have people swearing at you when they read the code.

Collapse
bhagatparwinder profile image
Parwinder 👨🏻‍💻 Author

Thanks for the feedback. Yup, that is why I specified if you ever plan on using an empty statement. If you don't and stick to empty blocks there is nothing to worry about.