title: Why don't we use the data type for function parameters in javascript?
body: <p>In javascript if I have to use a variable foo then I have to first define it as <code>var foo</code>. But when we use parameters in functions, e.g. as:  </p>
  
  <pre><code>function myfunc(bar) {  
    alert(bar);  
  }
  </code></pre>
  
  <p>why don't we write <code>function myfunc(var bar) {...}</code> instead? How does javascript know that <code>bar</code> is a variable? I remember that in C++ we have to tell that the compiler that the parameter being passed to the function is a variable as  </p>
  
  <p><code>int myfunc ( char bar[] ) {...}</code></p>