Jacobs, Andy wrote:
> function test(a = 0) {
JavaScript (at least 1.x) does not have a syntax to define default
values for function parameters.
However what you can do is
function test (a) {
if (typeof a === 'undefined') {
a = 0;
}
}
That is more code but it does what you want, if no value is passed for
the parameter a then the value 0 is assigned in the function.
--
Martin Honnen
http://JavaScript.FAQTs.com/
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino