Single parameter function in javascript

Draft Disclaimer: Please note that this article is currently in draft form and may undergo revisions before final publication. The content, including information, opinions, and recommendations, is subject to change and may not represent the final version. We appreciate your understanding and patience as we work to refine and improve the quality of this article. Your feedback is valuable in shaping the final release.

Language Mismatch Disclaimer: Please be aware that the language of this article may not match the language settings of your browser or device.
Do you want to read articles in English instead ?


  • Main reasons

Main reasons

  • evolutionary & maintenance
  • named parameter
    • you know what to expect under which name
    • you can add one when you need to without disrupting the previous order In my express app I systematically send this response
      class AppResponse {
        constructor (data, type, message) {
          // ...
    Two weeks into the projects I may forget which signature is the good one. I am using typescript but it can't catch this errors
      // user retrieved from the database
      const user = {name: 'John Doe', email: '[email protected]'}
      const response = new AppResponse(user, 'success', 'You')
  • bug prevention