ObjectBoilerPlateModule - some methods to assist creating objects


/ Published in: JavaScript
Save to your folder(s)

# 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".

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

Usage:

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.