Guest User

Untitled

a guest
May 8th, 2012
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. var A = function(x,y){var a=arguments,b=a[0],c=a.callee,d=this;if(!(d instanceof c))return new c(a);if(c==b.callee)return c.apply(d,b);d.x=x;d.y=y;};
  2.  
  3. var a = A(1,2);
  4. console.log(a.x, a.y); // 1 2
  5. console.log(a instanceof A); // true
  6.  
  7. var b = new A(3,4);
  8. console.log(b.x,b.y); // 3 4
  9. console.log(b instanceof A); // true
Advertisement
Add Comment
Please, Sign In to add comment