Java Reference
In-Depth Information
discount(20);
<< NaN
It will work, though, if both values are entered:
discount(10,20);
<< 18
And it will also work if undefined is supplied as the first argument, since amount will
then default to 10 :
discount(undefined,20);
<< 18
This somewhat defeats the object of having default parameters! The golden rule to remem-
ber here is that a ninja always put default parameters after all the other parameters.
Search WWH ::




Custom Search