JS Equivilent of func_get_args()

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Kadanis
Forum Contributor
Posts: 180
Joined: Tue Jun 20, 2006 8:55 am
Location: Dorset, UK
Contact:

JS Equivilent of func_get_args()

Post by Kadanis »

Hey all,

I'm looking for a javascript equivalent of the php function func_get_args() so I can pass any number of arguments to the JS script.

Does any know if there is something like this and what it is?

Cheers
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: JS Equivilent of func_get_args()

Post by VladSun »

http://www.devx.com/tips/Tip/13163
[js]function foo() {  var argv = foo.arguments;  var argc = argv.length;  for (var i = 0; i < argc; i++) {    alert("Argument " + i + " = " + argv);   }} foo('hello', 'world');[/js]

EDIT: Code pasted.
Last edited by VladSun on Mon Jun 02, 2008 6:25 am, edited 1 time in total.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Kadanis
Forum Contributor
Posts: 180
Joined: Tue Jun 20, 2006 8:55 am
Location: Dorset, UK
Contact:

Re: JS Equivilent of func_get_args()

Post by Kadanis »

Brilliant. Thanks a million.
Post Reply