Does a javascript if statement with multiple conditions test all of them?

The && operator “short-circuits” – that is, if the left condition is false, it doesn’t bother evaluating the right one.

Similarly, the || operator short-circuits if the left condition is true.

EDIT: Though, you shouldn’t worry about performance until you’ve benchmarked and determined that it’s a problem. Premature micro-optimization is the bane of maintainability.

Leave a Comment