JS basic data type and syntax summary (1/3)

Source: Internet
Author: User
Tags numeric

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.

Home 1 2 3 last

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.