Browse - Programming Tips - javaScript: how can I use lambdas / arrow functions ?

Date: 2018mar31
Language: javaScript

Q.  javaScript: how can I use lambdas / arrow functions ?

A.  Arrow functions (=>) are a light weight replacement for anonymous functions.  For example:

const squareOld = function(x) { return x * x; } const squareModern = x => x * x; console.log(' old=' + squareOld(10)); console.log('modern=' + squareModern(10));
So they are cool, but too cutting edge to be used just yet. https://googlechrome.github.io/samples/arrows-es6/