I just learned that I can overwrite a method in a Javascript class, as shown below, but what about the actual constructor?
If possible, how do I do it without instantiating the class?
var UserModel = (function() {
var User;
User = function() {}; // <- I want to overwrite this whilst keeping below methods
User.prototype.isValid = function() {};
return User;
})();
Just temporarily save the
prototypeobject, and then replace the constructor function: