JavaScript data types

Source: Internet
Author: User

1. Basic data type (return data type with typeof, start with lowercase letters)

Undefined

Boolean

String

Number

Object

The data type of the Null:null is object.

2.Number type

Includes integral and floating-point types.

var box=9.0;

alert (box);//auto-Convert to Integer 9 output

var num=1.12e3;//Scientific counting method

The number valid range is obtained through max_value and Min_value, and you can isfinite the function to return if the range is exceeded.

3.NaN (not a number)

Used to indicate that a numeric type should be returned but not returned. The isNaN function returns True or FALSE.

var box=0/0;

alert (box);//Return Nan

var box= ' 12sdffs ';

Alert (parseint (box));//output 12,parseint can also return octal and 16 binary numbers

4.String type

In ECMAScript, single and double quotation marks are the same resolution mechanism.

The ToString method can convert a value to a string.

5.Object type

Note the empty object is null and the empty object is Var obj={};

objects can be created by using the new operator.

var box=new Object ();

alert (box);

You can also pass parameters to create objects, such as:

var box=new Object (2);

alert (box); Print out 2

Alert (typeof (Box));//Print Object

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.