Javascript libraries seem to be all the vogue now days. Unfortunately many of them are becoming bloated with features and are growing larger than 50KB. Some developers may only use 10% of the libraries features too. One of the more common features is the dollar sign function i.e. $('element'). Of course I am a bit biased since I am a hardcore CSS person (thanks Jason) so I shy away from JavaScript as much as possible. Over time I have found that JS is necessary and many times the only solution to some problems.

One thing you'll notice with JavaScript programming is the methods and property calls can get quite lengthy. There is a solution to this and that is to create your own custom functions with shorter function names.

Short Named JavaScript Functions:

function gd(e) { return document.getElementById(e); } function gs(e) { return document.getElementById(e).style; } function gv(e) { return document.getElementById(e).value; } function dw(i) { return document.write(i); }

Each of these is simply a shorter way of calling the built in JavaScript functions. By using these you can reduce the file size of of you JavaScript and also increase the legibility. Probably the only con to these functions is there will be a performance decrease since the code will have to do an extra call each time it's used.

If you can think of any other down and dirty JS functions feel free to leave a comment and fill me in.

Sources: