var A = function(){ this.called = -1; } A.prototype.valueOf = function(){ this.called += 1; Return this.called; } var a = new A()