The original type is stored directly on the stack (stack), and the reference type is stored on the heap (heap).
The original type is divided into the following 5 kinds: Undefined, Null, Boolean, number, String
Undefined type:
The undefined type has only one value: undefined. When declaring a variable uninitialized, its default value is: undefined.
When a function does not explicitly return a value, the value returned is also: undefined
Null type:
Null type has only one value: null. The value undefined is actually derived from the value null, so the ECMAScript definition is equal:
alert (null==undefined);//outputs: "True"
Null and undefined values are equal, the meaning of the expression is different: undefined is declared when the variable is not initialized, the assigned value; Null represents an object that does not exist, such as a function returns an object, the object is not found, the return is null.
Boolean type:
Boolean type has 2 values: True and False
Number type:
The number type can represent a 32-bit integer or a 64-bit floating-point number.
Integers by default are 10, or 8 (the first number is 0, such as 070, 10 into 56), 16 (the first 2 is 0x, such as 0xAB, corresponding to 10 into 171).
Regardless of how the number is represented, the result of the operation is the 10 binary result.
To define a floating-point number, you must have a decimal point and a 1-digit decimal place after the dot, such as Var f=2.0. The storage of floating-point numbers is stored as strings.
String type:
Strings are declared with double quotes (") or single quotes (').
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