JavaScript logical operators

Source: Internet
Author: User

//comparison Operators            //the "= = =" Variable type and value are equal "= =" an empty string and false have the same meaning            varA=false; varB= ""; if(a===b) {Alert ("A equals B");//do not play the windowConsole.log ("a equals B");//No output display            }            varA=false; varB= ""; if(a==b) {                //alert ("a equals B");//a equals BConsole.log ("a equals B");//a equals b            }            //the operand of the logical operator is a Boolean value. Each logical operand returns a Boolean value of True to live false.             //Logic and &&: only if his two operands are true will it be true.             varNum=3; if(num>=5&&num<=10) {Console.log ("The number is in the right range");//No output results            }            //Logical OR | | : If one of his operands is true, the logic or operation will be true, and the logic or operation will be false only if his two operands are false.             varNum=3; if(num>=5| | num<=10) {Console.log ("The number is in the right range");//The number is in the right range            }        </script> 

JavaScript logical operators

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.