Logic or (|) operations in js and logic operations in js

Source: Internet
Author: User

Logic or (|) operations in js and logic operations in js

The logic or: | is used in js. The following describes its usage:

1. If there is a Boolean value of true, true is returned.

2. If it is not a Boolean value:
A. if the first operand is an object, the first operand is returned;
B. If the evaluate result of the first operand is false, the second operand is returned;
C. If both operands are objects, the first operand is returned;
D. If the two operands are null, null is returned;
E. If the two operands are NaN, NaN is returned;
F. If the two operands are undefined, undefined is returned.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.