title: Annotate javascript function parameters?
body: <p>Is it possible to annotate JavaScript function parameters as can be done with <em>attributes</em> in C#?</p>
  
  <p><strong>Example (C#)</strong>:</p>
  
  <pre><code>public void DoSomething([RequiredAction(Action="some_action")] Client client) {
      // ...
  }
  </code></pre>
  
  <p>The aim is - given a function - use reflection to inspect for instance the "type" of the parameters and perform the necessary conversions before calling it. <em>JavaScript</em> is indeed dynamically typed, but one could for instance want to use annotations to define the "type" of instances, a specific function expects (for instance, <code>param</code> should be an integer, or an array).</p>
  
  <p><strong>EDIT</strong>: The type aspect is only one possible use of an annotation. One could for instance also specify one must first run a specific function on that attribute or aspects like the maximum allowed length of an array.</p>
  
  <p>One can of course use <a href="https://stackoverflow.com/a/9924463/67579">this answer</a> and annotate the parameters by using specific parameter prefixes. For instance the <a href="https://en.wikipedia.org/wiki/Hungarian_notation" rel="noreferrer">Hungarian notation</a> where <code>sParam</code> would identify the parameter should be a string. But that's not really convenient nor that extensible since it requires to specify names. Is there a more generic way to achieve this?</p>