The big pit inside the "+" sign in JavaScript

Source: Internet
Author: User

1 + number inside the big pit;2 1, String + any number is stitching3 var a = 3;4 var b = "4";5 alert (a+b);//346 7 2, undefined+ any string is stitching8 var A;9 var b = "Zhang San";Ten alert (a+b);//a Zhang San One  A 3, false+ any number false to the implicit type conversion to 0 - var bool = false; - var num1 = 3; the alert (BOOL+NUM1);//3 -              - 4, true+ any number true for implicit type conversion to 0 - var bool = true; + var num1 = 3; - alert (BOOL+NUM1);//4 +              A 5, null+ any string; splicing at var str = null; - var num1 = "Zhang San"; - alert (STR+NUM1);//null Zhang San -         

The big pit inside the "+" sign in JavaScript

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.