The Problem to be solved
I want to call a function passing a set of parameters. Using the first parameter (argument[0] if you will) I check for a value-match; if there is a match I want to recursively call this function, dropping that first parameter while passing the rest. Continue recursive calls (dropping arguements[0] for the subsequent call) as long there are parameters and long as I'm matching that first parameter.
What I think I know
arguments is an object-type. It's not an Array, though it does have a length attribute. You cannot use Array methods directly on an arguments object.
Why I'm scratching my head
I'm not seeing a clean way to split the argument list. I don't seem to be doing it right.
Or maybe the second, and subsequent, calls I'm not passing a comma delimited list in the call, rather a single parameter that is an Array.
Or maybe I need to use the "callee" attribute somehow for recursive calls.
I hesitate to show any code because it just seems like mush at this point.
Maybe This is the way to do it?[list=1][*]Save each argument value in an Array[*]Build a string from the array, leaving out the first element of the array[*]The string will be a comma-delimited list of parameter values[*]But now I'm passing a string, not a list of values per se?? [*]Seems like a Catch-22![/list=1]
I want to call a function passing a set of parameters. Using the first parameter (argument[0] if you will) I check for a value-match; if there is a match I want to recursively call this function, dropping that first parameter while passing the rest. Continue recursive calls (dropping arguements[0] for the subsequent call) as long there are parameters and long as I'm matching that first parameter.
What I think I know
arguments is an object-type. It's not an Array, though it does have a length attribute. You cannot use Array methods directly on an arguments object.
Why I'm scratching my head
I'm not seeing a clean way to split the argument list. I don't seem to be doing it right.
Or maybe the second, and subsequent, calls I'm not passing a comma delimited list in the call, rather a single parameter that is an Array.
Or maybe I need to use the "callee" attribute somehow for recursive calls.
I hesitate to show any code because it just seems like mush at this point.
Maybe This is the way to do it?[list=1][*]Save each argument value in an Array[*]Build a string from the array, leaving out the first element of the array[*]The string will be a comma-delimited list of parameter values[*]But now I'm passing a string, not a list of values per se?? [*]Seems like a Catch-22![/list=1]
Comment