The examples are good for beginners. But I wish people would stop using anonymous functions for everything. For the sake of cleaner code, debugging, instantly discernible code structure etc.
For example, my preferred method:
$('document').ready(init);
function init(){
}
vs
$('document').ready(function(){
});
It's a subtlety but an important one I think.
The examples are good for beginners. But I wish people would stop using anonymous functions for everything. For the sake of cleaner code, debugging, instantly discernible code structure etc. For example, my preferred method: $('document').ready(init); function init(){ } vs $('document').ready(function(){ }); It's a subtlety but an important one I think.