When operator | | Of the two operands is a Boolean value that performs a Boolean or operation on both counts.
It first calculates the first operand, and if the value of the expression can be converted to true, it returns the value of the expression on the left. Otherwise, calculate the second shipment.
Even if | | The operator's operand is not a Boolean, and it can still be treated as a Boolean or operation, because it can be converted to a Boolean value regardless of the type of value it returns.
On the other hand, the number of operations for a non-boolean is used | |, which uses the attribute it returns to a value that is not Boolean. This use of this operator is typically to select the first defined and Non-null value in a set of alternative values (that is, the first value that is not converted to false)
Cases:
var Max=max_width | | Preferences.max_width | | 500
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.