title: can a function reference itself in javascript?
body: <p>Suppose we define a function that simply increments its input by some stored value <code>dd</code>:</p>
  
  <pre><code>var obj={}
  obj.dd=1
  obj.f=function(x){
      return x+this.dd
  }
  </code></pre>
  
  <p>Alternatively you could create a closure for <code>dd</code> as follows but this would create a static increment as opposed to one that could be altered later:</p>
  
  <pre><code>var dd=1
  var f=function(x){
      return x+dd
  }
  </code></pre>
  
  <p>We could alternatively store <code>dd</code> in the function itself:</p>
  
  <pre><code>var obj={}
  obj.f=function(x){
      return x+this.f.dd
  }
  obj.f.dd=1
  </code></pre>
  
  <p>I am curious as to whether it is possible for a function to retrieve a variable attached to itself without going through a parent object, something like a <code>self</code> keyword that would refer to the function itself and would allow the following:</p>
  
  <pre><code>var f=function(x){
      return x+self.dd
  }
  f.dd=1
  </code></pre>
  
  <p>I know it is unnecessary to do such a thing but I think it would be cool if you could. </p>