Arguments are passed to functions when they are called. They are substituted for the formal parameters in the function declaration.
Because JavaScript is weakly typed, you will need to implement any type checking you need for yourself.
You can compare the arity property of the owning function with the length property of the arguments array. If they are unequal, then the function was called with the wrong number of arguments.
You can then check the type of the arguments one by one to compare them against the expected types.
This is a lot of work for little gain unless it is an important aspect of your design.
Prev | Home | Next |
argc parameter | Up | Argument list |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |