ES6

Iterators

  • for...in: for Objects
  • for...of: Arrays and other data
  • Supports break;continue;

Modules

  • export any  top-level function, class, var, let, or const
  • import too!

let and const

  • let: 'the new var', block level not function level
  • const: define at initialization, can't modify

yield / generators

  • towards async/await ES7
  • we use https://github.com/tj/co
  • non-blocking code in a nice way

template strings

  • just easier

arrow functions

  • shorter
  • changes this: block rather than function scoped

deconstruction

  • easy way to do assignment from objects
var o = {p: 42, q: true};
var {p, q} = o;

console.log(p); // 42
console.log(q); // true 

other things

  • classes
  • sets

you can do it too!

ES6 and Wenguins

By David Thompson

ES6 and Wenguins

  • 597