To illustrate writing higher order functions with arrows, let’s look at a classic example: add. In ES5 that would look like this:
function add(x){ return function(y){ return y + x; };}var addTwo = add(2);addTwo(3); // => 5add(10)(11); // => 21
It is a simple example of rewriting classic compound function into HOF
const add = x => y => y + x;var addTwo = add(2);addTwo(3); // => 5add(10)(11); // => 21
Short circuit Iteration Function, such as sort, forEach, filter, some
**const isNumber = n => x => x === n**const arr = ['1','2','3']
arr.filter( isNumber("3") )
This is useful for a few reasons:
_— [ES6] Functional Programming: cheatsheet:_https://medium.com/@peterchang_82818/es6-function-programming-cheatsheet-update-spread-note-example-tutorial-26f265b0ddf1
— https://developer.ibm.com/node/2016/01/11/higher-order-functions-in-es6easy-as-a-b-c/