JS Data type Conversion

Source: Internet
Author: User
JS data type Conversion blog Category:
  • Web Front end-js language core
JavaScript data type conversion ZCCST


2014-10-23
NULL = = ";//false
Let me be in deep thought, why not true?

By query, the type conversion is:
undefined = "undefined" (string)
NULL = "null" (String)
true = "true" (String)
False = "false" (string)
So null = = '; The value is false, because NULL is NULL when it is converted to a string.

But Null==undefined;//true is the exception.
As shown:





2014-10-22
1, string to number, there are three ways
(1) Conversion function parseint (), parsefloat ()
(2) explicitly convert number ("123");
(3) Using JS's weak type conversion. "123"-0.


Authoritative guide: type conversion is a separate section of chapter III types, values, and variables that is sufficient to illustrate the importance of this issue.
Three cases are highlighted:
(1) Display type conversion
(2) toString () and valueof () methods
(3) Conversion function parseint (), parsefloat ()
(4) object converted to original value
(5) using operator +,-and so on.

JS Data type Conversion

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.