Alex Rivera | Logout

JavaScript variable number of arguments to function

Asked 2010-01-26T18:06:29.600
665

Is there a way to allow "unlimited" vars for a function in JavaScript?

Example:

load(var1, var2, var3, var4, var5, etc...)
load(var1)
Edit
Report

1 Answer

6

Use the arguments object when inside the function to have access to all arguments passed in.

answered 2010-01-26T18:08:08.083

Your Answer