ES6

ECMAScript 6

Next version of JavaScript

About ECMAScript 6:

  • It became a standard in June 2015.
  • Its features are slowly appearing in JavaScript engines.
  • Transpilers (such as Babel and Traceur) let you compile ES6 to ES5 (and use it right now).

Current support:

Traceur CH45 FF40 IE11 Node 0.12
59% 58% 68% 20% 17%
BabelJS CH47(N) FF42(N) Edge Node 4.0
71% 63% 71% 68% 53%

http://kangax.github.io/compat-table/es6/

What is ECMAScript?

Let's go back in time

1995

  • May: Brendan Eich - Mocha (10 days)
  • September: Netscape Navigator - LiveScript
  • December: Sun Microsystems - JavaScript

1996

  • July 16: JScript (IE3) + VBScript
  • + CSS + HTML
  • "best viewed in IE/NetscapeNavigator"
  • IE4 - DHTML, propertiary DOM
  • "Browser Wars"

Standarization

  • Dec 1996: Netscape  Ecma
  • Result: ECMAScript
  • Jun 1997: ECMA-262 specification / ECMAScript 1
  • Jun 1998: ECMAScript 2 (ISO/IEC-16262)
  • Dec 1999: ECMAScript 3 - "modern JS"

ECMAScript

Standard

Implementations

  • JavaScript
  • JScript
  • ActionScript
  • Adpbe ExtendScript
  • QtScript
  • many others...

Quiz!

When Server Side JavaScript was first introduced?

Dec 1995

Netscape Enterprise Server

Who was next?

Internet Information Server (IIS) 

Microsoft, 1996

NodeJS?

2009?

NodeJS?

2009?

What it is?

  • Programming in the large
    • classes
    • interfaces
    • namespaces
    • packages
    • program units
    • optional type annotations
    • optional static type checking and verification
  • Evolutionary programming and scripting
    • structural types
    • duck typing
    • type definitions
    • multimethods
  • Data structure construction
    • parameterized types
    • getters and setters
    • meta-level methods
  • Control abstractions
    • proper tail calls
    • iterators
    • generators
  • Introspection
    • type meta-objects
    • stack marks

ECMAScript

When proposed?

2005

What number?

ECMAScript 4

When become standard?

NEVER

ES4 - 1999

2003 - ES4 interim report (work paused)

Adobe - ActionScript

Microsoft - JScript.NET

Feb 2005

Jesse James Garret

  • TC39 resume work on ES4 in fall of 2005:
  • ES3 +
  • the interim ES4 report +
  • ActionScript/JScript.NET experiences

Adobe, Mozilla, Opera, Google

ES 4 - the fun stuff:

  • classes, interfaces ...
  • type definitions...
  • getters, setters...
  • iterators, generators...

Microsoft, Yahoo

ES 3.1 - the boring stuff:

  • subset of ES4
  • incremental upgrade
  • bug fixes
  • minor new features

July 2008 - TC39, Oslo

It’s no secret that the JavaScript standards body, Ecma’s Technical Committee 39, has been split for over a year, with some members favoring ES4 […] and others advocating ES3.1 […]. Now, I’m happy to report, the split is over.

 

Brendan Eich:

The agreement:

  • incremental update - ES5
  • Major new release - Harmony
    • more modest than ES4
    • larger in scope than ES3.1
  • some features dropped
    • packages, namespaces, early binding
  • other developed in consensus with all of TC39

Next versions:

  • Dec 2009 - ECMAScript 5
  • Jun 2015 - ECMAScript 6

ECMAScript 6?

  • ECMAScript Harmony
  • ESHarmony - too abmitious
  • ECMAScript.next
  • ECMAScript.next = ECMAScript 6
  • ECMAScript 6 = ECMAScript 2015
  • ECMAScript 7 = ECMAScript 2016

How to use?

  • Native implementation
  • babel-node
    • npm install --global babel
  • babel-webpack loader
  • online babel REPL

Features

  • let / const
  • multiline strings + string templates
  • arrow functions
  • destructuring
  • for of
  • default parameter values + named parameters
  • spread operator ...
  • classes
  • maps, sets
  • modules
  • iterators, generators
  • proxies
  • promises

See You Soon!

ES6

By Krzysztof Jung

ES6

  • 1,324