tazzman tazzman - 1 year ago 121
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"); 

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download