Over a million developers have joined DZone.

The Exciting Future of Javascript

DZone's Guide to

The Exciting Future of Javascript

· Web Dev Zone ·
Free Resource

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

ECMAscript, 6th edition might bring us fat arrow notation – Douglas Crockford on fat arrows

function (x) {
    return x * x;
// becomes
(x) => x * x

Douglas’ post concerns itself mostly with the intricacies of how this is bound to the function objectand what the fat arrow notation might bring, what I see is something completely different.


vim (Photo credit: jwalsh)

Proper lambdas!

That’s right, functions that implicitly return with none of that big ugly function keyword! Hooray.

A bit tricky when you need a named function, but so far this is just an unofficial proposal, I’m sure they’ll figure something out by the time ECMA6 comes anywhere near being a standard (not in 2012).

As I said on hacker news Javascript is a beautiful language, trapped in bad syntax, peppered with poor semantic choices. What is left of a language once you take syntax and semantics out of the picture? Quite a lot.

What else is new

Spurred on by excitement I decided to poke around the wiki for the ongoing specification work of Ecma.

Some of the “tentatively approved” proposals include:

 1.  Array comprehensions and generators and iterators - a natural notation for constructing lists from lists, used a lot in python and haskell. 

// mapping
[ square(x) for (x of [1,2,3,4,5]) ]
// filtering
[ x for (x of a) if (x.color === ‘blue’) ]

This naturally extends into generators, where you can have an object generating values according to a pattern – possibly until infinity. (the example given in the proposal are fibonacci numbers, obviously)

Iterators are a similar beast – you get to define how an object should be iterated over, which gives us nice abstractions for all sorts of things.

2.  Classes -- although using prototypes, functions and instances is enough to do everything classes can do, it isn’t very expressive and too much deep knowledge is required to understand the code.

A class defines four objects and their properties: a constructor function, a prototype, a new instance, and a private record bound to the new instance. The body of a class is a collection of member definitions.

3. Block scoped bindings – Javascript used to only be lexically scoped, otherwise known to new programmers as “Aaaaaah everything is global what the hell!?”. With the addition of let, const and block functions there will now also be block scope where you can define things to only exist inside two {}.

4. Modules!

What has traditionally been solved using require.js will now work similar to how python does it. You get to define modules and then import them where they are needed. Possibly the most earth shattering addition since dependency management in Javascript has devolved into an extreme sport lately.

// module
module math {
    export function sum(x, y) {
        return x + y;
    export var pi = 3.141593;
// client
// we can import in script code, not just inside a module
import {sum, pi} from math;
alert("2π = " + sum(pi, pi));

5. Proxies - according to the proposal a Proxy is an object that takes two objects – a target and a handler. Where, if I understand correctly, you call functions on the proxy (trigger them), which execute as traps on the handler object, using the target.

This looks like a new way of handling events.Similar to what modern MVC frameworks are doing where you have a “view” that takes care of safely executing functions when events are triggered.


A lot more interesting stuff can be found in the strawman section where completely far out ideas live, but the tentatively approved ideas already raise my hopes far too much without any assurance I’ll ever get any of this. So much could change before any of this is solidifies into a standard.

And even when it does become a standard … how long before any of this reaches wide browser support? Mozilla’s Javascript already includes a lot of this stuff – a lot of the proposals come from there actually – anyone else? Not really.

At least there is some comfort in the fact all of this will quickly reach node.js :)


Take a look at an Indigo.Design sample application to learn more about how apps are created with design to code software.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}