Posted By

codernator on 12/29/12


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


ObjectBoilerPlateModule - some methods to assist creating objects

 / Published in: JavaScript

addMethod - By John Resig (MIT Licensed)

Add a method to an object. Creates function overloading scenario based entirely on length of argument list. Won't work to overload functions according to argument "type".


Create parameter-less inheritance chain for situations in which the parent object takes arguments in its "constructor".


function A(a, b) { }
function B() {, 1, 2); }
B.prototype = inherit(A.prototype);

Report this snippet  

You need to login to post a comment.