There are 6 types of JavaScript data:
- numeric data type (number);
- strings (string);
- Boolean data (Boolean);
- Objects (object);
- Null (NULL);
- Undefined (Undefined).
(a), number
var a = 12;alert (a);
The value of eject a is 12.
var a = 12;
"typeof is the type of view variable. " the number that pops up is number, the return parameter of a is number, the type is number type" uppercase letter is data type, lowercase letter is the return parameter "
(b), String
var a = ' abc '; alert (a);
The value of a pop-up is ABC.
var a = ' abc '; alert (typeof a);
The popup is a string, stating that A's return parameter is a string, and the type is of type string.
var a = ' 2 ' + ' 3 '; alert (a);
The value of a pops up is 23, because at this point 2 and 3 are a string, that is, 2 and 3 are merged together.
var a = ' 2 ' + ' 3 '; Aert (typeof a);
The popup is a string, stating that A's return parameter is a string, and the type is of type string.
var a = ' 2 ' +3; alert (a);
The value of a that pops up is 23.
var a = ' 2 ' +3; Alert (typeof a);
The return value is string, indicating that a is a string data type at this point.
var a = ' 2 ' +3+4+ ' 5 '; alert (a);
The popup is also 2345, because it is in order, ' 2 ' +3 is a string, string plus 4 or string, String plus string ' 5 ' is finally a string. therefore for 2345.
var a = ' 2 ' + (3+4) + ' 5 '; alert (a);
The value of a that pops up is 275.
var a = ' 2 ' + (3+4) + ' 5 '; Alert (typeof a);
The return value that pops up is string and is still a string data type.
var a = ' 2 '-' 1 '; alert (a);
The value of a that pops up is 1. Because in JS, only the "-" string is subtracted.
var a = ' 2 '-' 1 '; Alert (typeof a);
The return value of the popup is number, which is the numeric value type.
var a = ' 2 '-1; alert (a);
The value of a that pops up is 1.
var a = ' 2 ' -1;alert (typeof a);
The return value of the popup is number, which is the numeric value type.
(c), Boolean
var a = true; alert (a);
The value that pops up is true.
var a = True;alert (typeof a);
The value returned is a Boolean. The description data type is a Boolean type.
Not finished ...
JavaScript data type (top)