JS basic data type and grammar summary
1, whether for static language or dynamic language, type is always the eternal topic, with the type we can describe our data to the machine, describe our operation so as to describe the problem we want to solve, but the type of static language needs our own to grasp, and dynamic language as far as possible to achieve automation processing.
2. Numeric types: Reference to C # and Perl processing, all numeric types are internally represented as floating-point numbers, but numeric types can be automatic boxing operations.
3, BOOL Type: TRUE and false.
4, String type: "A good Man".
5. Reference type: The above three basic types are all reference types, and the object of reference type is actually a hash table.
The reference type is detailed:
1, there are two ways to create a reference type object.
The first way:
JS Code
var circle1={x:0,y:0,radius:2};
var circle1={x:0,y:0,radius:2}; the second way:
JS Code
function Circle (X,y,radius)
{
This.x=x;
This.y=y;
This.radius=radius;
}
Circle1=new Circle (0,0,2);
function Circle (X,y,radius)
{
This.x=x;
This.y=y;
This.radius=radius;
}
Circle1=new Circle (0,0,2);
These two methods produce the same object, from the second method of creating a reference object can see the high consent of functions and objects, because the function itself is an object, so the function directly as a reference type of the constructor, is really high.