Can function operator be aliased?

javascript

Solution

Is there a way to alias function operator without too much overhead?

Nope.

Unless of course you're using ECMAScript 6 which supposedly will contain what's called "fat arrow" syntax:

var test = (arg1, arg2) => arg1 + arg2;

Until then, you're stuck constantly declaring:

var test = function (arg1, arg2) { return arg1 + arg2 };

or

function test(arg1, arg2) {
    return arg1 + arg2;
}

Problem

Is there a way how to alias `function` operator without too much overhead like eval? I'd like to write ``` fn test() { ... } ``` instead of ``` function test() { ... } ``` to strip some bytes in minified code. Just curious.

Original source