Hacker News new | ask | show | jobs
by edflsafoiewq 716 days ago
If you don't have named parameters, you can fall back to variables

  var taxInvoice = false
  var sendEmail = true
  RaiseInvoice(taxInvoice, sendEmail)
It's obvious, but people tend not to do it.
1 comments

Sadly there is nothing that can tell you that you got those arguments backwards.
Point taken. But you can check the declaration of RaiseInvoice and see if the names match. If you had RaiseInvoice(false, true) then you really wouldn't know.
Totally a matter of taste, but for an equal level of protection and less vertical waste I’d rather just do

    RaiseInvoice(/*taxInvoice*/ false, /*sendEmail*/ true)