In a function declaration, while the parameters do not have to be named, is it preferable to have them named? What are the advantages and disadvantages of this?
The advantage of naming them is that you can refer to them in the documentation. (This includes your editor/IDE picking them up and presenting them to you as hints when you type a call to such a function.)
A disadvantage would be that names might change according to the function's implementation, except for the fact that the names in a function declaration might differ from those in the function's definition. (IOW: I see no disadvantage.)
For documentation reasons mainly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With