Say I have a class and some static helper methods like this:
function MyClass (myVar) { this.myVar = myVar; this.replaceMe = function (value) {
How about just returning the new instance:
function MyClass(myVar) { // ... this.replaceMe = function (value) { return MyClass.staticHelper(this, value); } // ... } MyClass.staticHelper = function (instance, value) { return new MyClass( instance.myVar += value ); }