Data type mappings for Data Object Services : JavaScript data type overview
  

JavaScript data type overview

JavaScript supports five primitive data types, as shown in the following table.
Table 38. JavaScript primitive data types
Data type
Description
Examples
string
A string of characters enclosed in double or single quotes.
"jump rope"
number
An unquoted numeric value, which can include an exponent using scientific notation.
17
54.35
0.9582e-42
boolean
The unquoted, lowercase, literal value true or false.
true
null
The unquoted, lowercase, literal value, null.
null
undefined
The unquoted, lowercase, literal value, undefined.
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 true or false without surrounding quotes indicates a boolean.
*The string null without surrounding quotes indicates a literal null value that typically represents a variable, object property, or function return value that is not assigned to any other data type value.
*The string undefined without surrounding quotes also indicates a literal undefined value 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.
Table 39. OpenEdge-supported non-standard JavaScript data types
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:
Table 40. JavaScript complex data types
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.
{ myString : "jump rope",
 'myNum' : 17,
  'myBool' : false }
Array
A comma-delimited list of unnamed values, either primitive or complex, enclosed in brackets ([])
[ "jump rope", 17, false ]
Note: JavaScript also supports standard objects with the same type names as the primitive data types written by convention using initial upper case, for example, a Number object. These objects serve as wrappers for the corresponding primitive types and provide additional operations on these primitive types.