title: Convert var to const javascript
body: <p>Is it possible to convert a var to a const?</p>
  <p>Say in a scenario like this:</p>
  <pre><code>var appname = ''
  
  function setAppName(name) {
     appname = name  // can I convert this to const now?
  }
  </code></pre>
  <p>Basically, this is for a parameter level. Parameter needs to be accessible throughout the file and I want to make it const after first assignment.  Is this possible?</p>
  <p>To add: If there is any other way besides creating an object with to contain this parameter, it would be better (for a more straightforward solution). I will be working on multiple parameters like this and freezing an object will cause the entire object to freeze. I am hoping to do this on the parameter level.</p>
  <p>So either change the parameter to become const. OR (this one I dont think is possible) change the scope of the paramter to global:</p>
  <pre><code>function setAppName(name) {
     const appname = name  // can I change the scope and make this global?
  }
  </code></pre>
  <p>Thanks.</p>