title: How do I make Array.indexOf() case insensitive?
body: <p>I am making a piece of code for a website that will have a list of names in an array and pick a random name, I want to add a feature that will let the user add or delete a name from the array. I have all of these features but when deleting a name, the user has to type the name to match the Case in the array. I tried to make the so it would be Case-Insensitive, what am I doing wrong?</p>
  
  <pre><code>&lt;html&gt;
  &lt;!--Other code uneeded for this question--&gt;
  &lt;p id="canidates"&gt;&lt;/p&gt;
  &lt;body&gt;
  &lt;input type="text" id="delname" /&gt;&lt;button onclick="delName()"&gt;Remove Name from List&lt;/button&gt;
  &lt;script&gt;
  
  //Array of names
  
  var names = [];
  
  //Other code uneeded for this question
  
  //List of Canidates
  document.getElementById('canidates').innerHTML = 
  "&lt;strong&gt;List of Canidates:&lt;/strong&gt; " + names.join(" | ");
  
  //Other code uneeded for this question
  
  //Remove name from Array
  
  function delName() {
      var dnameVal = document.getElementById('delname').value;
      var pos = names.indexOf(dnameVal);
      var namepos = names[pos]
      var posstr = namepos.toUpperCase();
      var dup = dnameVal.toUpperCase();
      if(dup != posstr) {
          alert("Not a valid name");
          }
      else {
          names.splice(pos, 1);
          document.getElementById('canidates').innerHTML = 
          "&lt;strong&gt;List of Canidates:&lt;/strong&gt; " + names.join(" | ");
          }
      }   
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>