Skip to content

Instantly share code, notes, and snippets.

@gtzilla
Forked from j2labs/gist:1247091
Created September 28, 2011 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gtzilla/1247115 to your computer and use it in GitHub Desktop.
Save gtzilla/1247115 to your computer and use it in GitHub Desktop.
> function foo(x,y) {
if(arguments.length > 2) throw new Error("Stupid no method overloading lameness error");
... args = Array.prototype.join.call(arguments, ",");
... console.log('X:' + x + ' Y:' + y + ' Args:' + args)
... }
> foo(1,2)
X:1 Y:2 Args:1,2
> foo(1,2,3,4,5)
X:1 Y:2 Args:1,2,3,4,5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment