这是如何实现的:
var obj = obj || {};
obj.Something = (function() {
function Something() {
};
Something.prototype.someMethod = function() {
};
return Something;
})();
与此不同的是:
obj.Something = function() {
};
obj.Something.prototype = {
};
这些模式有何不同? 什么情况下我应该使用其中之一?