
Untitled
By: a guest on
May 8th, 2012 | syntax:
None | size: 0.46 KB | hits: 11 | expires: Never
140byt.es::forcetor
=========
A 116 byte tweet-sized snippet of code you can paste into ANY constructor function without modification to force use as a constructor.
How to use
-----------
Use the constructor with or without new, and receive back an instance object.
OR...
Copy and paste the following code into the top of your constructor (116 chars):
var a=arguments,b=a[0],c=a.callee;if(!(this instanceof c))return new c(a);if(c==b.callee)return c.apply(this,b);