You can try to use javascript not as a pure object-oriented language (which is not the case), but what uses functions and closures, which are its specifics.
function _class(init){
var _private = init;
return {
_method:function(param){
alert(_private + param);
}
};
};
_class('Stack')._method('Overflow');
If you have the courage to read / debug it, the jQuery source code is a very good example of using JavaScript.
source
share