JavaScript data types of String and boolean
String
String type is used to represent sequences of characters from zero to a plurality of 16-bit Unicode characters, i.e., the string. The string may be represented by double quotation marks ( ") or a single quote ( ')
toString()与String()
- Syntax: str.toString ()
- Function: Convert a string str
- Returns: a copy of str
- Parameters: str is the content to be converted, can be a numeric, boolean, string objects, and
- Note: I do not know whether to be converted value is null or undefined circumstances, you can still use the String () function, which can be any type of value to a string
Boolean
Type used to represent true and false, that is true if true, false false representation
Type Conversion
- All numbers except 0, converted to a boolean are true
- In addition to "" (empty string) all the characters, are converted to a boolean to true
- null and undefined is converted to a boolean is false