<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="Reality">
<TITLE>RWA_TAG Example</TITLE>
</HEAD>
<BODY>
<P>
The following example shows how to check that a function is invoked with the correct number of parameters, since JavaScript doesn't do this for you:
</P>
<PRE>function f(x, y, z) {
<span style="color: green">// First check that the right number of parameters were passed.</span>
if (arguments.length != 3) {
alert('function f called with ' + arguments.length +
'parameters - 3 parameters expected.');
return null;
}
<span style="color: green">// Now do the actual function...</span>
}</PRE>
</BODY>
</HTML>