1 # History of user-visible changes
7 * Unicode characters in identifiers (improved).
8 * [Delegating yield](http://wiki.ecmascript.org/doku.php?id=harmony:generators#delegating_yield).
9 * [ES6 numeric literals](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-numeric-literals) (octal, binary).
10 * Harmony [array and generator comprehensions](http://wingolog.org/archives/2014/03/07/es6-generator-and-array-comprehensions-in-spidermonkey).
16 * [Arrow functions](http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax)
17 * [Generators](http://wiki.ecmascript.org/doku.php?id=harmony:generators)
18 * [Spread operator](http://wiki.ecmascript.org/doku.php?id=harmony:spread)
22 ### Support for JSLint global declaration
24 See the docstring for `js2-include-jslint-globals`.
28 ### We don't rebind `RET` anymore
30 Because well-behaving major modes aren't supposed to do that.
32 So pressing it won't continue a block comment, or turn a string into a concatenation.
33 Pressing `M-j`, however, will.
35 The options `js2-indent-on-enter-key` and `js2-enter-indents-newline` were also removed.
37 To bring back the previous behavior, put this in your init file:
40 (eval-after-load 'js2-mode
41 '(define-key js2-mode-map (kbd "RET") 'js2-line-break))
46 ### Support for [default](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/default_parameters) and [rest](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/rest_parameters) parameters
50 ### Support for [for..of loops](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of)
54 ### Popular indentation style
57 [foo, bar, baz].forEach(function (v) {
62 [a, b, c].some(function (v) {
67 ### Pretty multiline variable declaration
77 In this mode when the value of `js2-pretty-multiline-declarations` is non-nil,
85 ### Abbreviated destructuring assignments
88 let {a, b} = {a: 10, b: 20}; // Abbreviated (Not supported in the original mode)
89 let {a: a, b: b} = {a: 10, b: 20}; // Same as above (Supported in the original mode)
91 (function ({responseText}) { /* */ })(xhr); // As the argument of function
93 for (let [k, { name, age }] in Iterator(obj)) // nested
97 ### Expression closure in property value
103 fire: function () _fire()
107 ### Fix for odd indentation of "else if" with no braces
109 In the original mode,
127 ### Imenu support for function nesting
129 Supports function nesting and anonymous wrappers:
133 var foo = function() {
134 function bar() { // shown as foo.bar.<definition-1>
135 function baz() {} // foo.bar.baz
136 var qux = function() {}; // foo.bar.quux
144 * [jQuery 1.5](https://gist.github.com/845449)
145 * [Underscore.js](https://gist.github.com/824262)
146 * [Backbone.js](https://gist.github.com/824260)
148 For library-specific extension methods like `$.extend` and `dojo.declare`, see [js2-imenu-extras](/mooz/js2-mode/blob/master/js2-imenu-extras.el).
150 ### Undeclared/external variables highlighting
152 Original mode highlights them only on the left side of assignments:
156 hose = new House(); // highlights "hose"
159 Here they are highlighted in all expressions:
162 function feed(fishes, food) {
163 for each (var fish in fshes) { // highlights "fshes"
164 food.feed(fsh); // highlights "fsh"
166 hood.discard(); // highlights "hood"
170 Destructuring assignments and array comprehensions (JS 1.7) are supported:
173 let three, [one, two] = [1, 2];
174 thee = one + two; // highlights "thee"
176 function revenue(goods) {
177 // highlights "coast"
178 return [price - coast for each ({price, cost} in goods)].reduce(add);