1. Basic data type (return data type with typeof, start with lowercase letters)
Undefined
Boolean
String
Number
Object
The data type of the Null:null is object.
2.Number type
Includes integral and floating-point types.
var box=9.0;
alert (box);//auto-Convert to Integer 9 output
var num=1.12e3;//Scientific counting method
The number valid range is obtained through max_value and Min_value, and you can isfinite the function to return if the range is exceeded.
3.NaN (not a number)
Used to indicate that a numeric type should be returned but not returned. The isNaN function returns True or FALSE.
var box=0/0;
alert (box);//Return Nan
var box= ' 12sdffs ';
Alert (parseint (box));//output 12,parseint can also return octal and 16 binary numbers
4.String type
In ECMAScript, single and double quotation marks are the same resolution mechanism.
The ToString method can convert a value to a string.
5.Object type
Note the empty object is null and the empty object is Var obj={};
objects can be created by using the new operator.
var box=new Object ();
alert (box);
You can also pass parameters to create objects, such as:
var box=new Object (2);
alert (box); Print out 2
Alert (typeof (Box));//Print Object
JavaScript data types