Possible Duplicate:
Pass arbitrary number of parameters into Javascript function
How can the following be achieved with n arguments?
function aFunction() {
    if ( arguments.length == 1 ) {
        anotherFunction( arguments[0] );
    } else if ( arguments.length == 2 ) {
        anotherFunction( arguments[0], arguments[1] );
    } else if ( arguments.length == 3 ) {
        anotherFunction( arguments[0], arguments[1], arguments[2] );
    }
}
function anotherFunction() {
    // got the correct number of arguments
}