Last active
January 10, 2019 09:16
-
-
Save sym3tri/911166 to your computer and use it in GitHub Desktop.
How AND, OR, and COMMA operators are evaluated in JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//(LHE: left hand expression, RHE right hand expression) | |
LHE && RHE | |
1. Always evaluate LHE | |
2. If LHE is true, evaluate RHE | |
LHE || RHE | |
1. Always evaluate LHE | |
2. If LHE is false, evaluate RHE | |
LHE, RHE | |
1. Always evaluate LHE | |
2. Always evaluate RHE | |
credit: http://javascriptweblog.wordpress.com/2011/04/04/the-javascript-comma-operator/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment