I am looking into systems for making JavaScript libraries. I have seen most of the libraries using methods such as "Immediately Invoked Function Expression". This method to me makes the code quite unreadable.
I want to know what are the advantages of using this method?
And what are limitations of using the basic .prototype system for creating a library?
For instance, what is wrong with using this pattern to create a library?:
function Library(){
this.property = 'val';
}
Library.prototype.method = function(){
// a method
}
//and to use the library
var lib = new Library();