ES6 Arrows - 21 Jan 2015

ES6 is bringing a wealth of new features to javascript. One of the new features I’m most excited about is arrow functions. Shorter function declarations are one of my favorite features from coffeescript, and I’m looking forward to seeing something similar in javascript.

Unlike in coffeescript, it is necessary to use brackets for multiline functions, but they can be skipped for shorter functions. Here’s a couple examples below:

// Normal{ return p.length });

// Arrow p => p.length );

// Multiline

var complex = (a, b) => {
  if (a > b) {
    return a;
  } else {
    return b;

Feel free to check out the full documentation here.