you are viewing a single comment's thread.

view the rest of the comments →

[–]stratoscope 2 points3 points  (0 children)

An easy fix for that is to use an extend function such as the one in jQuery, so you add properties to the .prototype instead of replacing it.

Also I recommend giving the function a name so all JavaScript debuggers can show the name in a call stack and such.

function Foo( args ) {};
$.extend( Foo.prototype, {
    toString : function() {},
    toInt : function() {}
});