|
1 | 1 | ---
|
2 |
| -title: ES6 |
| 2 | +title: ECMAScript 2015 (ES6) |
3 | 3 | layout: docs.hbs
|
4 | 4 | ---
|
5 |
| -# ES6 in Node.js |
| 5 | +# ECMAScript 2015 (ES6) in Node.js |
6 | 6 |
|
7 | 7 | Node.js is built against modern versions of [V8](https://developers.google.com/v8/). By keeping up-to-date with the latest releases of this engine, we ensure new features from the [JavaScript ECMA-262 specification](http://www.ecma-international.org/publications/standards/Ecma-262.htm) are brought to Node.js developers in a timely manner, as well as continued performance and stability improvements.
|
8 | 8 |
|
9 |
| -All ES6 features are split into three groups for **shipping**, **staged**, and **in progress** features: |
| 9 | +All ECMAScript 2015 (ES6) features are split into three groups for **shipping**, **staged**, and **in progress** features: |
10 | 10 |
|
11 | 11 | * All **shipping** features, which V8 considers stable, are turned **on by default on Node.js** and do **NOT** require any kind of runtime flag.
|
12 | 12 | * **Staged** features, which are almost-completed features that are not considered stable by the V8 team, require a runtime flag: `--es_staging` (or its synonym, `--harmony`).
|
13 | 13 | * **In progress** features can be activated individually by their respective harmony flag (e.g. `--harmony_destructuring`), although this is highly discouraged unless for testing purposes.
|
14 | 14 |
|
15 |
| -## Which ES6 features ship with Node.js by default (no runtime flag required)? |
16 |
| - |
| 15 | +## Which features ship with Node.js by default (no runtime flag required)? |
17 | 16 |
|
18 | 17 | * Block scoping
|
19 |
| - |
20 | 18 | * [let](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let) (strict mode only)
|
21 |
| - |
22 | 19 | * [const](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const)
|
23 |
| - |
24 |
| - * `function`-in-blocks (strict mode only) |
25 |
| - |
26 |
| - >As of v8 3.31.74.1, block-scoped declarations are [intentionally implemented with a non-compliant limitation to strict mode code](https://groups.google.com/forum/#!topic/v8-users/3UXNCkAU8Es). Developers should be aware that this will change as v8 continues towards ES6 specification compliance. |
27 |
| -
|
| 20 | + * `function`-in-blocks (strict mode only [[1]](#ref-1)<span id="backref-1"></span>) |
28 | 21 | * [Classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) (strict mode only)
|
29 |
| - |
30 | 22 | * Collections
|
31 |
| - |
32 | 23 | * [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
|
33 |
| - |
34 | 24 | * [WeakMap](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)
|
35 |
| - |
36 | 25 | * [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)
|
37 |
| - |
38 | 26 | * [WeakSet](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet)
|
39 |
| - |
40 | 27 | * [Typed arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays)
|
41 |
| - |
42 | 28 | * [Generators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*)
|
43 |
| - |
44 | 29 | * [Binary and Octal literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Numeric_literals)
|
45 |
| - |
46 | 30 | * [Object literal extensions](https://github.com/lukehoban/es6features#enhanced-object-literals) (shorthand properties and methods)
|
47 |
| - |
48 | 31 | * [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
49 |
| - |
50 | 32 | * [New String methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla#Additions_to_the_String_object)
|
51 |
| - |
52 | 33 | * [Symbols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)
|
53 |
| - |
54 | 34 | * [Template strings](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings)
|
55 |
| - |
56 | 35 | * [Arrow Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)
|
57 |
| - |
58 | 36 | * [new.target](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target)
|
59 |
| - |
60 | 37 | * [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
|
61 |
| - |
62 | 38 | * [Spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator)
|
63 | 39 |
|
64 | 40 | You can view a more detailed list, including a comparison with other engines, on the [compat-table](https://kangax.github.io/compat-table/es6/) project page.
|
65 | 41 |
|
66 |
| -## Which ES6 features are behind the --es_staging flag? |
| 42 | +<small id="ref-1">[[1](#backref-1)]: As of v8 3.31.74.1, block-scoped declarations are [intentionally implemented with a non-compliant limitation to strict mode code](https://groups.google.com/forum/#!topic/v8-users/3UXNCkAU8Es). Developers should be aware that this will change as v8 continues towards ES6 specification compliance.</small> |
67 | 43 |
|
68 |
| -* [`Symbol.toStringTag`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) (user-definable results for `Object.prototype.toString`, behind flag `--harmony_tostring`) |
| 44 | +## Which features are behind the --es_staging flag? |
69 | 45 |
|
| 46 | +* [`Symbol.toStringTag`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) (user-definable results for `Object.prototype.toString`, behind flag `--harmony_tostring`) |
70 | 47 | * [`Array.prototype.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) (determine whether
|
71 | 48 | an array includes a certain element, behind flag `--harmony_array_includes`)
|
72 |
| - |
73 | 49 | * [Rest Parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) (represent an indefinite number
|
74 | 50 | of arguments as an array, behind flag `--harmony_rest_parameters`)
|
75 | 51 |
|
76 |
| -## Which ES6 features are in progress? |
| 52 | +## Which features are in progress? |
77 | 53 |
|
78 | 54 | New features are constantly being added to the V8 engine. Generally speaking, expect them to land on a future Node.js release, although timing is unknown.
|
79 | 55 |
|
|
0 commit comments