Guest User

Untitled

a guest
May 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. function Constructor () {
  2. // do something with variable args.
  3. for (var i in arguments) {
  4. this[i] = arguments[i]
  5. }
  6. }
  7.  
  8. function factory () {
  9. var n = Object.create(Constructor.prototype)
  10. , o = Constructor.apply(n, arguments)
  11. return (typeof o === "object" && o) || n
  12. }
  13.  
  14. var f = factory(1, 2, 3, 4, 5)
Add Comment
Please, Sign In to add comment