See short-circuit evaluation for the explanation. It’s a common way of implementing these operators; it is not unique to JavaScript.
More Related Contents:
- JavaScript OR (||) variable assignment explanation
- Multiple left-hand assignment with JavaScript
- What is the quickest way to subtract a variable from a number and set the variable?
- Node.js bug ? function’s return value change when stored as variable
- html form that passes information to a variable in javascript [closed]
- What is the scope of variables in JavaScript?
- console.log() shows the changed value of a variable before the value actually changes
- What does “var FOO = FOO || {}” (assign a variable or an empty object to that variable) mean in Javascript?
- Declaring variables without var keyword
- Operator precedence with Javascript Ternary operator
- Are Variable Operators Possible?
- Why is the value of my input always empty if I store it in a variable?
- How to swap two variables in JavaScript
- What does ${} (dollar sign and curly braces) mean in a string in JavaScript?
- JavaScript code trick: What’s the value of foo.x
- Javascript: Converting String to Number?
- Javascript “Variable Variables”: how to assign variable based on another variable?
- Javascript variables in HTML attributes
- Access variable outside function scope [duplicate]
- Effect of declared and undeclared variables
- Why does shadowed variable evaluate to undefined when defined in outside scope?
- jQuery ajax return value [duplicate]
- ReferenceError: variable is not defined
- What does an exclamation mark before a variable mean in JavaScript
- Javascript date variable assignment
- Use JavaScript variable as function name?
- How do I combine 2 javascript variables into a string
- Setting onclick to use current value of variable in loop [duplicate]
- Can a JavaScript variable be used in plain HTML?
- Javascript: Get access to local variable or variable in closure by its name [duplicate]