I'm doing all sorts of JS experiments to clarify various language points, many being run in Eclipse using Run As --> Node application (or Node program).
I'm surprised to find that Array.prototype.flat()
is not available, although it is in my browser (Firefox 70), and am wondering what version of JS my Eclipse NodeJS installation is running.
My system's CLI version of NodeJS is v10.16.3. This also does not recognise Array.flat()
. I haven't been able to find out the version of ECMAScript to which this corresponds (if it does). The version of "NodeEclipse" installed in Eclipse is said to be 1.0.2. I don't know how to read across from there to the NodeJS version...
There's a "pure-JS" answer here about obtaining the JS version, but you have to access the document
, which I can't when I'm not running in a browser. Isn't there a simple way to find this out?
I'm confused: does Eclipse run a particular version of Node, and does a particular version of Node correspond to a particular version (ECMAScript version) of JS?
If I could just somehow get the Node version and the ES version when running a script this would help a great deal! Maybe there's some idiot-proof feature test?
PS
To add to my general bafflement: Array.flat()
is not listed in the general page for Array.prototype, but it is listed as a method of Array.prototype on another page. Nor do either of these pages say to which ECMAScript version they correspond. Perhaps I should presume it is the latest for FF, since this is Mozilla, (i.e. ES7)?