首页 > 代码库 > ES6 will change the way you write JS code.
ES6 will change the way you write JS code.
https://hacks.mozilla.org/2015/04/es6-in-depth-an-introduction/
Counting to 6
The previous editions of the ECMAScript standard were numbered 1, 2, 3, and 5.
What happened to Edition 4? An ECMAScript Edition 4 was once planned—and in fact a ton of work was done on it—but it was eventually scrapped as too ambitious. (It had, for example, a sophisticated opt-in static type system with generics and type inference.)
ES4 was contentious. When the standards committee finally stopped work on it, the committee members agreed to publish a relatively modest ES5 and then proceed to work on more substantial new features. This explicit, negotiated agreement was called “Harmony,” and it’s why the ES5 spec contains these two sentences:
ECMAScript is a vibrant language and the evolution of the language is not complete. Significant technical enhancement will continue with future editions of this specification.
This statement could be seen as something of a promise.
Promises resolved
ES5, the 2009 update to the language, introduced Object.create()
, Object.defineProperty()
, getters and setters, strict mode, and the JSON
object. I’ve used all these features, and I like what ES5 did for the language. But it would be too much to say any of these features had a dramatic impact on the way I write JS code. The most important innovation, for me, was probably the new Array
methods: .map()
, .filter()
, and so on.
Well, ES6 is different. It’s the product of years of harmonious work. And it’s a treasure trove of new language and library features, the most substantial upgrade for JS ever. The new features range from welcome conveniences, like arrow functions and simple string interpolation, to brain-melting new concepts like proxies and generators.
ES6 will change the way you write JS code.
This series aims to show you how, by examining the new features ES6 offers to JavaScript programmers.
We’ll start with a classic “missing feature” that I’ve been eager to see in JavaScript for the better part of a decade. So join us next week for a look at ES6 iterators and the new for-of
loop.
ES6 will change the way you write JS code.