JavaScript Data types

Source: Internet
Author: User

Each of the values of JavaScript is a data type of some kind.

In the ES5???, data type is divided into six kinds: five kinds of raw data types, the type of data types.

In the original data type?, divided into five categories:

Number (numeric) type: contains integers and floating-point numbers (that is, number);

Boolean (Boolean) type: Only true and false two values;

String (String) type: The string value must be enclosed in quotation marks, which can be single or double quotation marks;

Null type:? to indicate that a variable value is empty;

Undefined type:? To determine a variable that has been created but has no initial value.

The numeric type of JavaScript contains all the integer types and all floating-point types.

But don't distinguish between integers and floating-point numbers. Number indicates. Floating-point type floating-point type, that is, the value contains the integer part, the number of points and the part.

var num1 = 0.1; var num2 =. 1; //

Valid, but Nan Nan is not recommended as a special value for JavaScript, which means "? Number" (Not a numbers).

NaN is not a number, but its data type is type #.

Feature: Any operation that involves Nan will return Nan nan and not equal to any value, including Nan itself

Note: For these features, JavaScript provides the IsNaN () function.

This function is used to determine whether the calculated result is a numerical value.

If it is a number, returns False if it is not a number, which returns TRUE.

JavaScript data type raw data type (primitive type) number (numeric) type

Console.log (IsNaN (10)); False

Console.log (IsNaN ("Hello"));//True

JavaScript Data types

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.