O'Reilly logo
  • Ivan Petrov thinks this is interesting:

Expression closures are a shortcut for writing simple functions. If expression closures look familiar to you, it is because they are very similar to how lambda expressions work in other languages such as Lisp.

// => 10
[1, 2, 3, 4].reduceRight(function(curr, val) curr + val);

Using the new fat arrow syntax in ES 6, you can save even more characters.

// => 10
[1,2,3,4].reduceRight((curr, val) => curr + val);


Cover of Expert JavaScript


expression closures and functions