Big Douglas begetObject revisited recycling a unique function
With the precedent post I realized I wrote a really tricky way to extend inline a function.Next code is the snippet summary: MyExtendedConstructor.prototype = function(Function){ var callee = arguments.callee; if(!(this instanceof callee)){ callee.prototype = Function.prototype; return new callee; } }(MyBaseConstructor); Above code uses the closure itself to create the intermediate constructor. The reason i chose this way to operate that task was: why should I use another function when I already have one that is the closure itself? Well done, one function instead of two ... but wait a second, why should I create a different function everytime instead of recycle a single one? Douglas Crockford begetObject concept In one of His historical posts , Big Douglas describes simple JavaScript inheritance and object cloning using an intermediate constructor. This is the Object.create function: Object.create = function (o) { function F() {} F.prototype = o; ...