Description
JS_GetVersion reports an encapsulated JavaScript version number used within a specified JSContext, cx. The version number is an enumerated value that corresponds to the JavaScript version string with which JS users are familiar.
The following table lists possible values reported by JS_GetVersion, the enumerated value you can use for the JS version in your code, and provides a translation to the actual JavaScript version string:
|
Value
|
Enumeration
|
Meaning
|
100 |
JSVERSION_1_0 |
JavaScript 1.0
|
110 |
JSVERSION_1_1 |
JavaScript 1.1
|
120 |
JSVERSION_1_2 |
JavaScript 1.2
|
130 |
JSVERSION_1_3 |
JavaScript 1.3
|
0 |
JSVERSION_DEFAULT |
Default JavaScript version
|
-1 |
JSVERSION_UNKNOWN |
Unknown JavaScript version
|
If JSVERSION_DEFAULT is returned by JS_GetVersion, it indicates that the current script does not provide a version number and that the script is executed using the last known version number. If that version number is unknown because a script without a specified version is the first to execute, JS_GetVersion still returns JSVERSION_DEFAULT.
|