Skip to content

Instantly share code, notes, and snippets.

@j2labs
Created September 28, 2011 05:54
Show Gist options
  • Save j2labs/1247091 to your computer and use it in GitHub Desktop.
Save j2labs/1247091 to your computer and use it in GitHub Desktop.
> function foo(x,y) {
... 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
@gtzilla
Copy link

gtzilla commented Sep 28, 2011

I see what you're saying, but JS doesnt have strong typing either. if the intent is to ensure variables are being correctly passed, it seems like type safety would be something you want. and if that is the case, I would suggest JS is not an appropriate fit. however, i find this flexibility useful. if I want to create new MyObj or whatever, I can, but I'd dont work under the false ideal that I can check types... I also like the fact that prototypes can be grafted / called from any method and used in lots of ways.

js isnt a classic language, seems like traditional software patterns can be informative to JS, but prototypical langs are not classical...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment