JavaScript flexibility
In JS you have the natural flexibility to extend an object you have previously declared. Even more you can extend any native objects! That makes the writing of a jQuery, or whatever javascript library, plugins to be very easy.
As you may know in JS you can have object declared like that:
var obj = { a : 1, b : 2 };
That is an object with two properties a and b which values are respectively 1 and 2. If you’d like to extend this object later you can just write:
obj.c = 3
and now the object looks like that:
{ a : 1, b : 2, c : 3 }
That’s perfect when you’d like to write plugins to jQuery. Continue reading Writing a jQuery plugin – (part 1). Good practices!