var myCode = new function(){
this.one = function(){
//code
};
this.two = function(){
//code
};
};
<script>
$(function() {
myCode.one();
myCode.two();
});
</script>
var myCode = (function($) {
function myCode()
{
//code
};
return myCode;
})(window.jQuery);
var MyCode = (function($){
function MyCode () {
// constructor
}
MyCode.prototype.one = function(){
// code
};
MyCode.prototype.two = function(){
// code
};
return MyCode;
})(window.jQuery);
var myCodeInstance1 = new MyCode;
var myCodeInstance2 = new MyCode;
myCodeInstance1.one();
myCodeInstance1.two();
myCodeInstance2.one();
myCodeInstance2.two();