Reputation: 12220
I want to know which javascript version is my NodeJS is supporting ?
Upvotes: 42
Views: 26263
Reputation: 91
The best and most detailed version intel is at https://node.green. It shows a matrix of NodeJS version by JavaScript version. The JavaScript items include the standard name and each js feature. The node version includes the V8 version (hover over the node column header).
Upvotes: 6
Reputation: 3409
Run this script:
try {
var k = new Map();
console.log("ES6 supported!!")
} catch(err) {
console.log("ES6 not supported :(")
}
try {
var k = new HashMap();
console.log("ES100 supported!!")
} catch(err) {
console.log("ES100 not supported :(")
}
Upvotes: 7
Reputation: 446
Not trying to necropost, here -- however, this seems to be the way to accomplish this...it is a bit convoluted, however.
What I did was -- follow the method outlined here and then added some of my own...
node -p process.versions
{ http_parser: '2.8.0',
node: '11.2.0',
**v8: '7.0.276.38-node.11'**,
uv: '1.23.2',
zlib: '1.2.11',
ares: '1.15.0',
modules: '67',
nghttp2: '1.34.0',
napi: '3',
openssl: '1.1.0i',
icu: '63.1',
unicode: '11.0',
cldr: '34.0',
tz: '2018e' }
Then, it depends on your platform -- I have node running on Windows 10, so...
node --v8-options | find "in progress"
For Linux use...
node --v8-options | grep "in progress"
--harmony-do-expressions (enable "harmony do-expressions" (in progress))
--harmony-class-fields (enable "harmony fields in class literals" (in progress))
--harmony-static-fields (enable "harmony static fields in class literals" (in progress))
--harmony-await-optimization (enable "harmony await taking 1 tick" (in progress))
--harmony-locale (enable "Intl.Locale" (in progress))
--harmony-intl-list-format (enable "Intl.ListFormat" (in progress))
--harmony-intl-relative-time-format (enable "Intl.RelativeTimeFormat" (in progress))
V8 implements ECMAScript as defined in ECMA-262-- I am unaware of any way to relate that to any other 'version', however -- it will tell you what features are still in development.
If you omit the pipe to grep/find, you get a long list of all v8 options available.
Finally, I am not actually developing the Node application for use on my Windows 10 machine -- I am developing the Node application for a Raspberry Pi and using Visual Studio Code to ssh, so -- at my terminal prompt, I ssh into the RPi and use the Linux version above...
node -p process.versions
{ http_parser: '2.8.0',
node: '8.11.3',
v8: '6.2.414.54',
uv: '1.19.1',
zlib: '1.2.11',
ares: '1.10.1-DEV',
modules: '57',
nghttp2: '1.32.0',
napi: '3',
openssl: '1.0.2o',
icu: '60.1',
unicode: '10.0',
cldr: '32.0',
tz: '2017c' }
node --v8-options | grep "in progress"
--harmony_array_prototype_values (enable "harmony Array.prototype.values" (in progress))
--harmony_function_sent (enable "harmony function.sent" (in progress))
--harmony_do_expressions (enable "harmony do-expressions" (in progress))
--harmony_class_fields (enable "harmony public fields in class literals" (in progress))
--harmony_promise_finally (enable "harmony Promise.prototype.finally" (in progress))
--harmony_number_format_to_parts (enable "Intl.NumberFormat.prototype.formatToParts" (in progress))
--harmony_plural_rules (enable "Intl.PluralRules" (in progress))
Upvotes: 3
Reputation: 11586
According to its documentation, this command could be used;
node -p process.versions.v8
Upvotes: 7
Reputation: 46778
Use process.versions. From that page in the documentation:
console.log(process.versions);
outputs
{ node: '0.4.12',
v8: '3.1.8.26',
ares: '1.7.4',
ev: '4.4',
openssl: '1.0.0e-fips' }
EDIT: V8 uses the ECMAScript as specified in ECMA-262, 5th edition.
Reference: http://code.google.com/p/v8/
Upvotes: 26