title: How to call different types of functions in Javascript
body: <p>I just started programming and I've been playing around with it. I watched a programming course on lynda.com to start out, but it didn't cover functions very well, I know what they are, but I don't know the different formats of functions or how to call them. I know how to call simple things like this:</p>
  
  <pre><code>var foo=function {
      //code...
  }
  </code></pre>
  
  <p>but I want to use more complicated things like this (I'm starting to to things with HTML):</p>
  
  <pre><code>$(document).keypress(function(e)) {
      if(e.which == 13) {
          alert('You pressed enter!');
      }
  }); 
  </code></pre>
  
  <p>or just whatever other styles there are.</p>