title: Javascript Reflection
body: <p>Is there a way to get all methods (private, privileged, or public) of a javascript object from within? Here's the sample object:</p>
  
  <pre><code>var Test = function() {
  // private methods
      function testOne() {}
      function testTwo() {}
      function testThree() {}
  // public methods
      function getMethods() {
        for (i in this) {
          alert(i); // shows getMethods, but not private methods
        }
      }
      return { getMethods : getMethods }
  }();
  
  // should return ['testOne', 'testTwo', 'testThree', 'getMethods']
  Test.getMethods();
  </code></pre>
  
  <p>The current issue is the code in <code>getMethods()</code>, the simplified example will return just the public methods, but not to private ones.</p>
  
  <p><strong>edit</strong>: my test code may (or may not) be overcomplicating what i'm hoping to get at. given the following:</p>
  
  <pre><code>function myFunction() {
    var test1 = 1;
    var test2 = 2;
    var test3 = 3;
  } 
  </code></pre>
  
  <p>is there a way to find out what variables exist in <code>myFunction()</code> from within <code>myFunction()</code>. the pseudo-code would look like this:</p>
  
  <pre><code>function myFunction() {
    var test1 = 1;
    var test2 = 2;
    var test3 = 3;
  
    alert(current.properties); // would be nice to get ['test1', 'test2', 'test3']
  }
  </code></pre>