title: Make Javascript local variable to global for recursive loops
body: <p>I have a recursive function which has a local variable.
  It calls itself on specific condition.
  The local variable needs to be updated, but every call it creates a new local variable specific to the current function scope.
  How can i reach the local variable for access all recursive loop and not to create a new one?
  Something like __Callee.varname?</p>
  
  <p>The code is:</p>
  
  <pre><code>var addAttribute = function(object,elem)
  {
      var attributes = [];
  
      // only attribute without values
      if ( object instanceof Array )
      {
          for ( var value in object )
          {
              attributes.push(object[value]);
          }
      }
      // attribute with values
      else if ( object instanceof Object )
      {
          for ( var key in object )
          {
              if ( object[key] instanceof Array )
              {
                  addAttribute(object[key],elem);
              }
              else
              {
                  attributes.push(key+'=\''+object[key]+'\'');
              }
          }
      }
      // Only one attribute
      else if ( typeof object === 'string' )
      {
          attributes.push('\''+object+'\'');
      }
      // Invalid parameter
      else
      {
          console.log('Invalid parameter: '+typeof object);
      }
  
      console.log('&lt;'+elem+' '+attributes.join(' ').toString()+' /&gt;');
  
  }
  </code></pre>
  
  <p>I do not want to make variable to global because of using this name in other functions and global scope already.</p>