JavaScript data types
1. Original Data type:
numeric , such as decimal number, hexadecimal number, octal number, and special value (Infinity, nan), note: NaN cannot compare itself with
String type , such as delimiter, escape character;
the Boolean type .
2. Composite Data type:
Objects (object );
Arrays (array );
function .
3. Special Data Types:
no defined data type undefined;
The null value is Null.
The difference between null and undefined is that undefined means that the variable is not assigned, and null means that the variable is given a null value, and Null is equivalent to a placeholder.
JavaScript Data type conversions
1. Implicit conversion:
Convert to Boolean type false:
Convert to Numeric Data:
Convert to String Data:
2. Explicit conversion:
Convert to numeric value (by number () to numeric value, converted to integer by parseint (string,radix), parsefloat (tring) to floating-point values):
Convert to a string (converted to a string through a string function):
Convert to Boolean type (cast to Boolean by Boolean function):
JavaScript variables
1. Declare variables:
Declare variables with the Var keyword;
Variables can be declared at the same time to assign values;
You can declare one variable at a time, or you can declare multiple variables at once;
If only the variable is not assigned a value, the default value is undefined;
If the name of the variable produces an overlay.
Precautions:
Variables are strictly case-sensitive;
Variable names do not contain special characters;
Variable names are best followed by hump marking or underline method;
Variable names are best understood.
2. Storage and release of variables in memory:
Collection method: useless storage unit collection, automatic
Collect content:
Recovery Algorithm.
Data types and variables for JavaScript