Our favorite language is now powering everything from event-driven servers to robots to Git clients to 3D games. The JavaScript package ecosystem has quickly outpaced past that of most other languages, allowing our vibrant community to showcase their talent. The front-end framework war has been taken to the next level, with heavy-hitters like Ember and Angular ushering in the new generation of long-lived, component-based web apps. The extensible web movement, spearheaded by the newly-reformed W3C Technical Architecture Group, has promised to place JavaScript squarely at the foundation of the web platform. Now, the language improvements of ES6 are slowly but surely making their way into the mainstream— witness the recent interest in using generators for async programming. And all the while, whispers of ES7 features are starting to circulate…
JavaScript has grown up. Now it's time to see how far it can go.
3. WHATWG formed, focusing on web applications2004
Ajax (XMLHttpRequest) appears2005
jQuery 1.02006
4. V8 released, and the speed race begins
JS: The Good Parts released
2008
ES5
ServerJS/CommonJS
Node.js
PhoneGap
JSConf
2009
Backbone.js
RequireJS
2010
22. var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function () {
var sonar = new five.Sonar("A2");
sonar.on("data", function() {
console.log(this.cm);
});
});
42. es6 goals
Be a better language for writing:
- Complex applications
- Libraries (including the DOM) shared by those applications
- Code generators targeting the new edition
43. what’s in es6 anyway: syntax
Class sugar: class, extends, super
Arrow functions: arr.map(x => x * x)
Destructuring: var { x, y } = getPoint()
Rest/spread: var *first, …rest+ = els; Math.max(...myArray)
Parameter defaults: function parseInt(x, base = 10) { }
44. what’s in es6 anyway: data structures
Map: object-to-object O(1) access time
Set: O(1) lookup and storage
WeakMap/WeakSet: private state and branding
Iteration protocol: for-of across anything, even user iterables
Typed objects: const Point = new StructType({ x: uint32, y: uint32 });
45. what’s in es6 anyway: game-changers
Generators: lazy sequences and async/await-like syntax
Promises: standardized async; play well with generators
Subclassable builtins: custom arrays, dates, regexps, …
Proxies: virtual objects, no more .get(…)/.set(…, …)!
Template strings: jsx`<a href="${url}">${text}</a>`
Modules: an end to the AMD/CommonJS schism
47. what maybe possibly could be in es7
Weak references: useful for e.g. auto-cleanup of data-binding
Async/await: function^() { var res = await promise; }
Object.observe: no-overhead observation
Value types: both built-in (integers!) and user-defined
Bind operator: var method = ::obj.foo
Editor's Notes
(BE EXCITED!)It’s fun to take a step back and see how we got here. It’s been a long time since JavaScript came out!