Reputation: 18371
I found that Node use Chrome's V8 JavaScript engine. There's some information about ES6 support here, and here. There's even a switch for V8 options when using Node:
node --v8-options
But none of the options seems to allow the selection of the ECMAScript version.
Moreover here I found the information that few years ago Node supported ES3, but later, with the evolution of V8 it switched to ES5.
Is it possible to force Node to use versions of ECMAScript older than 5-th? Does currently used V8 engine support ES version selection at all?
Upvotes: 4
Views: 4886
Reputation: 26696
JS engines are no longer versioned against spec, because implementers didn't implement all features of a spec, and the feature sets which all vendors implemented certainly weren't in line with one another. It was a short-lived dream.
In order to demo on ES3, you'll need to run IE6 - 8. ...which has its own problems, because IE had quirks which make that hard, but plausibly doable.
Upvotes: 3
Reputation: 318182
All versions of EcmaScript are backwards-compatible with the previous versions.
ES3 features work in ES5, and ES5 features work in ES2015, so there should be no need to specifically run code in an ES3 enviroment, as ES3 code should work fine in ES5 and ES2015.
In general, there haven't been any breaking changes added to new versions of EcmaScript, even in ES5 when they decided to try and clean up the language a bit, they decided to add use strict
, as to not break anything in old code that ran in ES3.
Javascript engines do not generally have an option to run different versions of EcmaScript, as it shouldn't be needed, the latest version should be compatible with all previous versions of the standard.
Upvotes: 3