Javascript ES6: Before and After

by Travis Webb (tjwebb)

ECMA 5

ECMA 6

Norfolk.ecma?

ECMAScript is a Language Specification

(Deterministic Context-free Language for the linguistic nerds)

Javascript is a particular implementation of ECMAScript

An expanded ECMA specification make new Javascript features possible

Ratification in June 2015

But you can start using the features now

Some ES6 Features

  • promises
  • generators
  • iterators + for..of
  • let + const
  • template strings
  • arrows
  • classes
  • enhanced object literals
  • destructuring
  • default + rest + spread
  • unicode
  • modules
  • module loaders
  • map + set + weakmap + weakset
  • proxies
  • symbols
  • subclassable built-ins
  • math + number + string + object APIs
  • binary and octal literals
  • reflect api
  • tail calls

Before

After

Promises

User.create({ username: 'tjwebb' })

    .then(function (user) {
        console.log('hey', user);
    })

    .catch(function (e) {
        console.error('uh oh', e);
    });
User.create({ username: 'tjwebb' })

    .then(function (user) {
        console.log('hey', user);
    })

    .catch(function (e) {
        console.error('uh oh', e);
    });

es6

By Travis Webb