I\'m getting started with Node.js and I\'m having a hard time figuring out what version of JavaScript is supported by node which makes it difficult figuring out what feature
It seems as though we have been reduced to two strategies to figure out which version of Javascript node uses:
Strategy 1: trust in what some document somewhere says, which is wrong in many cases. I haven't found the table which indicates the key-value pairs of which version of node supports which version of ECMAScript.
Strategy 2: guess-and-check.
Find a feature quoted by ES6 and "see if it fails", something like this:
el@apollo:~/code$ echo "console.log('blue'.includes('blue'))" > a.js
el@apollo:~/code$ cat a.js
console.log('blue'.includes('blue'))
el@apollo:~/code$ node a.js
/home/el/code/javascript/02/a.js:1
ports, require, module, __filename, __dirname) { console.log('blue'.includes('
^
TypeError: undefined is not a function
at Object. (/home/el/code/javascript/02/a.js:1:82)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
el@apollo:~/code$ babel-node a.js
true
I suppose the "babel" here is a reference to the Tanakh. What features does our version of node support? Well, I don't know, you'll have to manually test it. This is going to become a giant MESS. And worse, it seems to be on purpose.