06-30-2015, 09:08 AM
(This post was last modified: 06-30-2015, 09:12 AM by Bombshell93.)
if anyone here knows javascript would you consider this a good practice for keeping clean code?
I can't think of any downside short of a slight cost in its creation, but ofc its only created once and it gives a lot more encapsulation control
Code:
var myObjectType = new function() {
//private static functions and variables
var constructor = function() {
//constructor stuff
};
constructor.prototype = new function() {
//public static functions and variables
//this functions
};
return constructor;
}