title: Javascript function have sub functions / variables
body: <p>This is the working code:</p>
  
  <pre><code>var test = function ()
  {
      console.log(test.data);
  };
  
  test.data = 'hello';
  
  test.set = function (data)
  {
      test.data = data;
  };
  
  test.set('Test');
  test();
  </code></pre>
  
  <p>This outputs <code>Test</code> to my javascript console.
  Now I was wondering, if there was a way to do it using something like this?</p>
  
  <pre><code>var test = {
      this: function ()
      {
          console.log(test.data);
      },
  
      data: 'hello',
  
      set: function (data)
      {
          test.data = data;
      }
  };
  </code></pre>