As far as I know, there is not a way to set default values for the function arguments in JScript.
You can use the following workaround:
- define a function with 3 arguments,
- call this function with only two arguments, in this case the third parameter will contain null,
- check the value of the third parameter in the function body and if it equals null, assign it a default value.
Here is an example:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[C++Script]
function test(t1, t2, t3)
if (t3 == null) t3 = "Default value"
This is code from JScript reference in MSDN about using "arguments" JScript property:
sorry but I'm can't write this code sample because this massage can't be transfered in forum cause of "Parenthesis in HTML tag " error. You can see this code in MSDN
As you can see the description of function ArgTest() has no parameters, but when it were called we transfered four parameters in it and by using JScript property "arguments" have acces to this parameters. Note that property "arguments" is supported by JScript version 5.5. Me be I'm not understood your question.