JavaScript data type overview
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
JavaScript data type overview
JavaScript supports five primitive data types, as shown in the following table.
| Data type | Description | Examples |
|---|---|---|
string
|
A string of characters enclosed in double or single quotes. |
|
number
|
An unquoted numeric value, which can include an exponent using scientific notation. |
|
boolean
|
The unquoted, lowercase, literal value true or false. |
|
null
|
The unquoted, lowercase, literal value, null. |
|
undefined |
The unquoted, lowercase, literal value, undefined. |
|
The data type of a primitive value is determined by the format of the value:
- A string of characters surrounded by quotes indicates the value is a
string. - A string of numeric characters without surrounding quotes and with an
optional decimal point, an optional negative sign, or an optional exponent indicates a
number. - The string
trueorfalsewithout surrounding quotes indicates aboolean. - The string
nullwithout surrounding quotes indicates a literalnullvalue that typically represents a variable, object property, or function return value that is not assigned to any other data type value. - The string
undefinedwithout surrounding quotes also indicates a literalundefinedvalue that typically represents a variable, object property, or function return value that is undefined.
In addition to these standard primitive data types, there are some commonly-used, but non-standard data types for certain values that are not officially supported in JavaScript. For these non-standard types, specially formatted strings represent values for which there is no standard primitive JavaScript data type.
The following table shows non-standard JavaScript data types that OpenEdge Data Object resources support.
| Non-standard JavaScript data type | Representation |
|---|---|
| Date | A string in the ISO
8601 format, "yyyy-mm-ddThh:mm:ss.sss+hh:mm".
JavaScript does support a Date object for working
with dates and times. However, all dates and times returned from an OpenEdge
application server to a JSDO are stored as a string
in the ISO 8601 format. |
| Binary data | A string consisting
of the Base64 encoded equivalent of the binary data, which in OpenEdge can be
represented in an ABL BLOB, MEMPTR, or
ROWID data type. |
For more information on the OpenEdge usage of the non-standard JavaScript data types in the previous table, see OpenEdge ABL to JavaScript data type mappings.
JavaScript also supports two complex data types, used to aggregate values of all JavaScript data types, including both primitive and complex data, as shown in the following table:
| Data type | Description | Examples |
|---|---|---|
Object
|
A comma-delimited list of named values (properties),
either primitive or complex, enclosed in braces ({}).
The property names can either be literal values or quoted strings. |
|
Array
|
A comma-delimited list of unnamed values, either
primitive or complex, enclosed in brackets ([]) |
|
Number object. These objects serve as wrappers for the
corresponding primitive types and provide additional operations on these primitive
types.