title: How to set first letter to upperCase on button click
body: <p>When i click button and it appears on web-page i want to do the first letter toUpperCase(); But i don't know how to it properly. I made it like this: </p>
  
  <pre><code>function toUpper() {
              arr.charAt(0).toUpperCase() + arr.slice(1);
   }
  </code></pre>
  
  <p>But this seems not correct, please explain how to do it right way?</p>
  
  <pre><code>    &lt;input type="text" id="inp"&gt;
      &lt;button class="btn"&gt;Push to array&lt;/button&gt;
      &lt;button class="delete"&gt;Delete&lt;/button&gt;
      &lt;br&gt;&lt;br&gt;
      &lt;div id="list"&gt;&lt;/div&gt;
  
  &lt;script&gt;
  
  var inp = document.getElementById("inp");
  var btn = document.querySelector(".btn");
  var list = document.querySelector('#list');
  var del = document.querySelector(".delete");
  var arr = [];
  
  btn.addEventListener('click', function() {
    var valInp = inp.value; 
    if (valInp === '') { return; }
    arr.push(valInp);
    inp.value = "";
    list.innerHTML = arr.join("&lt;br&gt;").trim();
  
      function toUpper() {
          arr.charAt(0).toUpperCase() + arr.slice(1);
      }
  });
  
   del.addEventListener('click', function(){
      arr.pop();
      list.innerHTML = arr.join("&lt;br&gt;").trim();   
  });
  
  &lt;/script&gt;
  </code></pre>