A little dive into => syntactic sugar.
Before :
Now :
Before :
> hello = function() { return "Hello World !" }
function() { return "Hello World !" }
> hello()
Hello World !
> hello = () => { return "Hello World !" }
() => { return "Hello World !" }
> hello()
Hello World !
> hello = () => "Hello World !"
() => "Hello World !"
> hello()
Hello World !
> [1,2,3].map( function(n) { return n*n } );
[ 1, 4, 9 ]
> [1,2,3].map( n => n*n );
[ 1, 4, 9 ]
No comments:
Post a Comment