JavaScript passes variables the same way most modern languages do. JavaScript's syntax is based on Java, which in turn is based on C/C++, which in turn.... Perl, JScript, VB, Fortran, and a host of other languages pass variables in the same way.

Code:
<html>
  <head>
    <title>Test Page</title>
    <script type="text/javascript">
      function myFunction (myVar) {
        alert(myVar);
      }
    </script>
  </head>
  <body>
    <p onclick="javascript:myFunction('Foo');">Click Me!</p>
  </body>
</html>