32

Is there a mapping somewhere from Node.js version, e.g. 0.10, or 14, to the corresponding ECMAScript version, e.g. ES5, ES2020?

As this question is closed, I can't post the solution I came up with as an answer, so it is here instead.

@bevry/node-versions includes fetchESVersionForNodeVersion(nodeVersion: string): Promise<string> which will fetch the ECMAScript version that was ratified by the time that the Node.js version was released.

6
  • 5
    node.green. See also e.g. stackoverflow.com/q/5139168/3001761. Commented Oct 26, 2020 at 22:44
  • There is no such thing as a direct mapping because no single node.js version represents a 100% transition from one version of the ECMAScript specification to a new version. Instead, it is a gradual adding of new language features over time and over many versions. As you've now received two recommendations for, node.green will show you the feature by feature transition between nodejs versions. Commented Oct 26, 2020 at 23:52
  • 1
    node.green is not really very useful, I find it very confusing for making a decision on which exmascript version to target given a base nodejs version. Commented Jan 3, 2023 at 17:51
  • if you googled here you probably want this: stackoverflow.com/a/57607634 Commented Apr 3, 2023 at 9:42
  • 2
    The best resource I have found so far is on tsconfig github repo, e.g.: github.com/tsconfig/bases/blob/main/bases/node16.json . Here you can find typescript config files for various node versions including it's corresponding javascript version (look at the target field). Commented Jul 26, 2023 at 10:01

1 Answer 1

15

Which features ship with which Node.js version by default?

The website node.green provides an excellent overview over supported ECMAScript features in various versions of Node.js, based on kangax's compat-table.

Source: https://nodejs.org/en/docs/es6/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.