List.prototype.RemoveItem = function() {
var Len = arguments.length;
if (Len > 0) {
// remove specified items
var i = 0;
for (; i < Len; i++) {
this.El.removeChild(arguments[i]);
}
}
else { // remove all
while (this.El.hasChildNodes()) {
this.El.removeChild(this.El.firstChild);
}
}
}
Any ideas ?
This question has come up previously (see thread entitled "Optional
arguments...") and there isn't any official way, but one possible
solution is this:
/**
* @param [...] Zero or more child nodes. If zero then ...
otherwise ....
*/
The square brackets indicate an optional parameter, and the ... would
(to me) indicate "some arbitrary number."
Another possibility is this...
/**
* @param [arguments] The child nodes.
*/
Either way should communicate what you mean.
Regards,
Michael
Explanation: I was simply confused by the fact, that there is more
than one optional argument, but I don't know how many. I thought I
would have to document each one of them with a @param, but how's that
possible if I don't know how many there are...
So I just did as you suggested:
* @param {object} [arguments] zero or more nodes
Thank you Simon