title: Javascript functions with their own methods
body: <p>I'm confused as to what the purpose or use cases are for functions being able to have method calls in JavaScript. I understand that functions are considered objects and thus can have their own properties and therefore functions, but it seems to me like it is still a little bit different than what I would call a standard object. For example, why would i ever do this... </p>
  
  <pre><code>var myFunction = function(){...};
  myFunction.method = function(){...};
  </code></pre>
  
  <p>Instead of creating an object and having one or more function properties like the following...</p>
  
  <pre><code>var obj = {method: function(){}};
  </code></pre>
  
  <p>And if we were to console.log each we get the following...</p>
  
  <pre><code>console.log(myFunction);
  console.log(obj);
  ------------------------------------------
  { [Function] secondFunction: [Function] }
  { method: [Function] }
  </code></pre>
  
  <p>I'm trying to learn the Express.js framework currently and it seems like it makes heavy use of this concept. What is the point?  Is this what is meant by a top level function?</p>