tazzman tazzman - 11 months ago 71
Javascript Question

Javascript alias for "Function" keyword

Ahoi community,

Is there a possibility to define an alias for the javascript keyword "Function"?

var f = Function; // define Function alias

var foobar = f() // write 'f' as replacement for 'function'


Answer Source

Arrow functions is what I was looking for (thx Xufox).

It's useful to minify your JS (thx Beejor).

To me it is also better readable and faster to code :)

So the snippet in the original question would look like:

var foobar = () => console.log("foobar");