I'm looking for a way to define javascript function arguments by array so that, for example, the following code would work. Is it possible?
args = ["foo", "bar"]
func = function(???) { //not sure what (if anything) could go here to make it work
console.log(foo)
console.log(bar)
}
func (5, "good times") // logs "5" and "good times"
EDIT: The offered solutions are good but don't address the problem because retention of the specific name is important. I have a function with an extremely long list of arguments, and I'd rather define them as an array then in the actual function definition.