Monday, November 7, 2016

Use the ES6 fat arrow for simple function substitution.

var x = y => alert(y+y);
x("hi");

 
 

...which is gonna tell you "hihi" is bascially the same as...

var x = function(y){
   alert(y+y);
};
x("hi");

No comments:

Post a Comment