title: use variable's name JavaScript (literally)
body: <p>How can I refer to the variable's name (literally the name of the variable)?</p>
  
  <p>I have the following code:</p>
  
  <pre><code>var thisVariableName = 'path/filename.js';
  
  var script = document.createElement('script');
  script.id = **I WANT THE TEXT "thisVariableName" to be added HERE**
  script.type = 'text/javascript';
  script.src = thisVariableName;
  </code></pre>
  
  <p>So that if output script.id, I would get thisVariableName as such, not the value of the variable</p>
  
  <p>AFTER SOME OF THE RESPONSES:</p>
  
  <p>I want to systematize the addition of many script files. 
  In the example below I add four files, but imagine I had to add 30+ files (please reserve yourself from asking why would I need to add 30+ files; after all this is the promise of computing)</p>
  
  <p>As of now, the only way I know how to get this done is to create two separate arrays; array 1 for the files' name string, and array 2 for the files' paths, or ALTERNATIVELLY, as Felix Kling SUGGESTS create an object per each variable:</p>
  
  <pre><code>var jQueryPath = 'js/jquery-1.5.1.js';
  var jQueryUICore = 'js/jquery.ui.core.js';
  var jQueryUIWidget = 'js/jquery.ui.widget.js';
  var jQueryUITabs = 'js/jquery.ui.tabs.js';
  
  var fileNames = new Array ('jQueryPath','jQueryUICore','jQueryUIWidget','jQueryUITabs');
  
  var filePaths = new Array (jQueryPath,jQueryUICore,jQueryUIWidget,jQueryUITabs);
  
  var head = document.getElementsByTagName("head")[0]; 
  
  for (var i=0;i&lt;4;i++){
  
      var script = document.createElement('script');
      script.setAttribute('id',fileNames[i]);
      script.setAttribute('type','text/javascript');
      script.setAttribute('src', filePaths[i]);
      head.appendChild(script);
  
      }
  </code></pre>
  
  <p>So whether I create arrays to hold the names and the values of the variables, or create an object, it requires individual creation of both attributes per file. </p>
  
  <p>I was hoping I could reference the literal variables' names of an array composed of the variables; i.e:</p>
  
  <pre><code>var onlyOneArray = new Array (jQueryPath,jQueryUICore,jQueryUIWidget,jQueryUITabs);
  
  for (var i=0;i&lt;4;i++){
  
          var script = document.createElement('script');
          script.setAttribute('id',**onlyOneArra[i] the NAME**);
          script.setAttribute('type','text/javascript');
          script.setAttribute('src', onlyOneArray[i]);
          head.appendChild(script);
  
          }
  </code></pre>