0
comment
comment
on 7/30/2010 12:48 AM
The jQuery approach is to avoid object orientation. This is an excellent way of avoiding bloat for small JavaScript hacks. If you’re starting to build JavaScript heavy applications then you might need to start organizing your code. The first thing you should learn is how to write jQuery plugins. Later on you will need to learn some simple object orientation. Here’s how:
function TigerType(name){
var that = this; this.name = name; this.sound = "growl!";
this.roar = function(){ return that.sound; };[...]