Using MooTools’ Alias Functionality
Hash.alias('forEach', 'each'); //Hash iteration Array.alias('forEach', 'each'); //Array iteration
Using "each" is shorter and faster to type than "forEach." With aliasing in mind, I thought of a few fun usages of MooTools' alias. All of the following are aliases for the Element.dispose() functionality:
/* prison house */ Element.alias('dispose', 'shank'); $('prisoner').shank(); /* animals */ Element.alias('dispose', 'beach'); $('whale').beach(); /* automobiles */ Element.alias('dispose', 'compound'); $('car').compound(); /* mafia */ Element.alias('dispose', 'concreteShoes'); $('wiseguy').concreteShoes();
In all seriousness, I recommend using alias when you want to refer to a specific functionality by giving it your own name.