We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

Data Type Summary

JScript provides many data types to use in your programs. These types can be divided into two main categories, value data types and reference data types (also referred to as JScript objects). To add types to JScript, you can import namespaces or packages that contain new data types, or you can define new classes that can be used as new data types.

The following table shows the value data types supported by JScript. The second column describes the equivalent Microsoft .NET Framework data type. You can declare a variable of the .NET Framework type or the JScript value type and achieve exactly the same results. The storage size (where applicable) and range are also given for each type. The third column lists the amount of storage required for one instance of a given type, if applicable. The fourth column provides the range of values that can be stored by a given type.

JScript value type

.NET Framework type

Storage size

Range

boolean

Boolean

N/A

true or false

char

Char

2 bytes

Any Unicode character

float (single-precision floating-point)

Single

4 bytes

Approximate range is -3.4E+38 to 3.4E+38 with accuracy of about 7 digits. Can represent numbers as small as 1E-44.

Number, double (double-precision floating-point)

Double

8 bytes

Approximate range is -1.79E+308 to 1.79E+308 with accuracy of about 15 digits. Can represent numbers as small as 1E-323.

decimal

Decimal

12 bytes (integral part)

Approximate range is -7.9E+28 to 7.9E+28 with accuracy of 28 digits. Can represent numbers as small as 1E-28.

byte (unsigned)

Byte

1 byte

0 to 255

ushort (unsigned short integer)

UInt16

2 bytes

0 to 65,535

uint (unsigned integer)

UInt32

4 bytes

0 to 4,294,967,295

ulong (unsigned extended integer)

UInt64

8 bytes

0 to approximately 1.8E+19

sbyte (signed)

SByte

1 byte

-128 to 127

short (signed short integer)

Int16

2 bytes

-32,768 to 32,767

int (signed integer)

Int32

4 bytes

-2,147,483,648 to 2,147,483,647

long (signed extended integer)

Int64

8 bytes

Approximately -9.2E+18 to 9.2E+18

void

N/A

N/A

Used as the return type for a function that does not return a value.

The next table shows the reference data types (JScript objects) that JScript provides and that can be used as types. Reference types do not have a predefined specific storage size.

JScript reference type

.NET Framework type

Refers to

ActiveXObject

No direct equivalent

An Automation object.

Array

Interoperates with Array and typed arrays

Arrays of any type.

Boolean

Interoperates with Boolean

A Boolean value, either true or false.

Date

Interoperates with DateTime

Dates are implemented using the JScript Date object. The range is approximately 285,616 years on either side of January 1, 1970.

Enumerator

No direct equivalent

An enumeration of items in a collection. For backward compatibility only.

Error

No direct equivalent

An Error object.

Function

No direct equivalent

A Function object.

Number

Interoperates with Double

A numeric value with an approximate range of -1.79E+308 to 1.79E+308 and with an accuracy of about 15 digits. Can represent numbers as small as 1E-323.

Object

Interoperates with Object

An Object reference.

RegExp

Interoperates with Regex

A regular expression object.

String Data Type (variable-length)

String

0 to approximately 2 billion Unicode characters. Each character is 16 bits (two bytes).

String Object (variable-length)

Interoperates with String

0 to approximately 2 billion Unicode characters. Each character is 16 bits (two bytes).

VBArray

No direct equivalent

A read-only Visual Basic array. For backward compatibility only.

NoteNote

In scientific notation, E refers to a power of 10. Therefore, 3.56E+2 signifies 3.56 x 102 or 356, and 3.56E-2 signifies 3.56 / 102 or 0.0356.

Show: