JavaScript allows functions to be treated as objects--if you first define a variable as a function, you can subsequently add properties to that function. How do you do the
var A = function(foo) { var B = function() { return A.prototype.constructor.apply(B, arguments); }; B.prototype = A.prototype; return B; };