JS Base _ Non-Boolean value and OR operation

Source: Internet
Author: User

1 <!DOCTYPE HTML>2 <HTML>3     <Head>4         <MetaCharSet= "UTF-8">5         <title></title>6         7         <Scripttype= "Text/javascript">8             9             /*Ten * && | | non-boolean value case One              *      A *-When a non-Boolean value is evaluated and or operated, it is converted to a Boolean value and then evaluated, and the original value is returned -              *      - *-with Operation: the *-If the first value is true, then a second value must be returned - *-If the first value is false, the first value is returned directly -              *  - *-or arithmetic + *-If the first value is true, the first value is returned directly - *-Returns a second value if the first value is False +              *  A              */ at              -             //true && true -             //and operations: If two values are true, then return to the back, who returns behind who -             varresult= 5 && 6; - Console.log ("result ="+result); //6 -              in              -             //and operation: If there is a false in two values, the forward false is returned to             //false && True + result= 0 && 2; - Console.log ("result ="+result); //0 the              * result= 2 && 0; $ Console.log ("result ="+result); //0Panax Notoginseng              -              the             //false && false + result=NaN&& 0; A result= 0 &&NaN; the Console.log ("result ="+result); //0 +              -             //----------------------------------------------------------------------------- $              $             //true | | true -             //if the first value is true, the first value is returned directly - result= 2 || 1; the Console.log ("result ="+result); //2 -             Wuyi result= 2 ||NaN; the Console.log ("result ="+result); //2 -              Wu result= 2 || 0; - Console.log ("result ="+result); //2 About              $              -             //if the first value is false, the second value is returned directly - result=NaN|| 1; - Console.log ("result ="+result); //1 A              + result=NaN|| 0; the Console.log ("result ="+result); //0 -              $ result= "" || "Hello"; the Console.log ("result ="+result); //Hello the              the result= -1 || "Hello"; the Console.log ("result ="+result); //-1 -              in              the         </Script> the          About     </Head> the     <Body> the     </Body> the </HTML>

JS Base _ Non-Boolean value and OR operation

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.