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