Original ecmascript type

Source: Internet
Author: User

--- Restore content start ---

Ecmascript has five primitive types: undefined, null, Boolean, number, and string.

1. typeof Operator

The typeof operator has a parameter, that is, the variable or value to be checked.

For example:

VaR EMP = "Hello World ";

Alert (typeof EMP); // output "string"

Alert (typeof 100); // output "Number"

---- If the variable is of the undefined type, undefined is returned;

---- If the variable is of the boolean type, the return value is boolean;

---- If the variable is of the number type, return number;

---- If the variable is of the string type, the return value is string;

---- If the variable is of the reference or null type, the object is returned.

Note: The typeof operator returns "object" for the null value, which is actually an error in the initial implementation of JavaScript and is followed by ecmascript. Now null is considered a placeholder for an object, which explains this contradiction, but technically it is still the original value.

2. Number Type

This data type can be a 32-bit integer or a 64-bit floating point number.

What's interesting about floating point literal is that before using it for computation, strings are actually stored.

Extended knowledge points:

① Common division functions

② Common multiplication Functions

Original ecmascript type

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.